Mixing javascript and jsp/servlets with forms
843835May 8 2002 — edited May 8 2002I have a simple HTML form. When I click submit the action calls either a JSP or servlet. I want to include some JavaScript which will do some basic validation checks on the data entered into the form when the submit button is clicked. The java servlet should only be called if the javascript validates the data successfully. How can I best acomplish this?
Can I check for an "onsubmit" event in javascript and have it call a javascript function to do my validation checks and then somehow direct the form action to my servlet after the fact if validation is successful?
Thanks in advance for any assistance (and code samples if possible ! :)
Peter W