Custom Dialog Box Message while Saving the Adobe Forms without filling the Mandatory Fields

...Previous  

14.   Write the Below Mentioned Java Script in the Editor.

function IsSpecified(oField)
{
	return (oField.rawValue != null) && (oField.rawValue.length > 0);
}
var bCanSubmit = true;
var message = "Message: Entry for the below Mandatory Fields are Missing! \n";
if (!IsSpecified(LFA1.P1.NAME1)) // The Field Node Name
	{
	message += "\n Vendor Name";  // \n = New Line
	bCanSubmit = false;
	}
if (!bCanSubmit)
{
var oDlg =
{
   description:
   {
      name: "Test Dialog",
      elements:
      [
{
            type: "cluster",
            name: "---- ERROR MESSAGE ----",
            elements:
            [      
         {
            name: "Some Mandatory Fields are Missing!",
            type: "static_text",
         },
         {
            name: "Please Click 'OK' and Save Again! By Filling the Mandatory Fields",
            type: "static_text",
         },
         {
            name: "If 'CANCLE' is Clicked, a Blank Copy of the Form would be Saved.",
            type: "static_text",
         },              
         {
            type: "ok_cancel",
         },
     ]
   }         
     ]
   }
};
// Dialog Activation
if ("cancel" == app.execDialog(oDlg))
{
xfa.host.resetData(); // Reset The Form
}
}  

15.   Create a Web Dynpro Application

16.   Test the Application

17.   In the below case if the Mandatory field is empty. In any case as it’s a standard Property of adobe we can’t stop it from saving. But we can change the data before saving.

18.   If the mandatory field is missing a POP up would be generated with the below message as mentioned in the Java Script.

19.   If OK is selected then the form would be Open and user can fill in the mandatory fields. If Cancel is selected then the Form would be refreshed and the enter data would be cleared in the saved form.

20.   The same is also applicable for the Close Button as well.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image