The “Performs Update” Property in the Button Click Actions
Validation of required fields in Infor CRM (Saleslogix) Web is something that is built in. However, how you set up the save button on your form does make a difference on whether or not it works. When you add a Save button to a form, by default it will set the Save button’s “Performs Update” property to true.
What this “Performs Update” property does is causes the save button to be registered as a save button with the ClientBindingManagerService. A button that is registered as a save button has it’s onClick event connected to the Sage.Utility.Validate.onWorkSpaceSave function. This function takes the top DOM node of the workspace and iterates through any dijit based controls that are located within the hierarchy below the top DOM node and invoke’s it’s validation. If any control fails validation, it’s isValid flag is set to false and the control is in an error state (indicated by the red error state of the control)
Problems with Required Field Validation on Save
Here’s where things can go wrong. If your save button does not have it’s “Performs Update” property set to true, any required fields will no longer be required. If you click the save button in Chrome & Firefox it will just save the form, even if required fields are missing. However in IE, the behavior is a bit different. If the form has it’s dirty data message showing, clicking the save button will do nothing at all and you will NOT see the red error state of required fields – just nothing happens with no indication as to why (in IE if there is no dirty data flag, it will save normally).
This is an important thing to remember. If you add a Save button to your form in AA and then change the action – for example, from the Save business rule to a C# Snippet Action instead, AA will automatically change the “Performs Update” from true to false. Then your save button will no longer be registered as a save button.
Registering Save Buttons on Custom SmartParts
If you’re working with a custom SmartPart, you’ll still need to register your Save buttons as save buttons in order to take advantage of the standard required field validation. To do this, add the following code to the OnFormBound event of your SmartPart:
// ClientBindingMgr is built-in from EntityBoundSmartPart // Otherwise it can be obtained via: // var ClientBindingMgr = PageWorkItem.Services.Get<ClientBindingManagerService>(); ClientBindingMgr.RegisterSaveButton(cmdSave);
Now, when your Save button (cmdSave) is clicked it will automatically trigger the onWorkspaceSave function which will cause validation to run on all dijit based controls.