Halt script if validation fails
I have form setup that once the data entry is done, the user presses the submit button and a script runs to commit the record and send an email.
It is working, except some of the fields have validation on them. If the validation fails, it does inform the user of the error and lets them correct it, but it is still sending the email. Is there a way to halt the script if validation fails. The only place I see I can do this is with a script trigger (on object save), but I don't see how I can use that with a button.
The commit records step does not have skip data validation checked.