Often times you want to block a user from saving a form if a certain field value is not in line with what you expect. Whether this is a drop-down selection, or a text field or date, this field is not a required field.
JS to the rescue.
The piece of code looks as follows:
// do all you data validation here
// if condition not met
In order for this to run properly, do not forget to select “Pass execution context as first parameter” when pointing to you ValidateFieldSelection function.
And by the way, this goes on the form OnSave event handler. Feel free to add an alert also, so the system user knows what’s happening.