Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

JavaScript Validation to Submit Form

$
0
0
Hi,

How do you validate all the fields in JavaScript when the user clicks the Submit button so that if any required fields are empty or any field validation fails, nothing (submission, JavaScript code, execute menu items, etc.) will be executed? I found something about execValidate() but it didnt work for me. It wouldnt do anything. I am using Adobe Acrobat Professional 8.0.

For instance, I have a field set up to accept numbers between 1111 and 9999. If the user enters 1 and tabs out of the field, he gets an error message and the value is deleted. The field is also set as a required field. But if the user clicks the Submit button, all JavaScript code will be executed, menu items too. The only thing that fails is "Submit a Form" only for the required field part. What can I include in the JavaScript code to check if all fields are valid, according to their corresponding rules, and if yes, continue to execute all the other actions. If not, cancel all and let user make the necessary changes.

Thank you for your help!

Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>