I have a problem in validating attribute on a form in CRM dynamics. I added a JavaScript code that validate the attribute value based on my business rules. and added to 2 events, form on save and field on change,
the question is:
1- Is this the best way to validate on attribute?
2- In case of using this way, how can i stop saving the form or passing it as valid ?
I believe that's a good way to validate input. In case you want to stop save in case one of validations fails do following:
In case your validation fails call following code:
execObj.getEventArgs().preventDefault()
You can find more details here -https://msdn.microsoft.com/en-us/library/gg509060.aspx