Showing a Message When a Page Has Missing Required Fields in Infor CRM Web

Many years ago I wrote an article titled Making Required Fields More Visible for SalesLogix 7.2 Web where I outlined how to display a message to the user when required fields are missing. Things have changed in CRM since then. In version 7.2, controls used ASP.NET validation with RequiredFieldValidators so you could accomplish showing a message about the missing required fields by using an ASP.NET ValidationSummary control. That is no longer the case since all of the validation is done using the Sage.Utility.Validate and Sage.Services.ClientBindingManagerService in tandem with the validation built into the control dijit/widgets themselves.

If you want to display a message to users when required fields are missing, you can simply use dojo/aspect to trigger your code after the onWorkSpaceSave in Sage.Utility.Validate.

require(['dojo/aspect', 'dojo/ready', 'Sage/Utility/Validate'], function (aspect, ready) {
    ready(function() {
        aspect.after(Sage.Utility.Validate, 'onWorkSpaceSave', function() {
            if (!this._isValid) {
                Sage.UI.Dialogs.alert('There are missing required fields', 'Required Fields Missing');
            }
        });
    });
});

You can add that code to the base.master or easily drop it in using our Custom Loader Module. Now, anytime the user clicks a save button on any form, they will also see the message/alert. Like this:

I’m not a huge fan of unnecessary alerts in web apps, so I would suggest using something more like toastr to display an out of the way notification that goes away on it’s own after a few seconds.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!