Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Mixing javascript and jsp/servlets with forms

843835May 8 2002 — edited May 8 2002
I 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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 5 2002
Added on May 8 2002
1 comment
283 views