aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to stop the onclick function running when onsubmit validation fail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to stop the onclick function running when onsubmit validation fail" Watch "How to stop the onclick function running when onsubmit validation fail" New topic
Author

How to stop the onclick function running when onsubmit validation fail

Usera User
Greenhorn

Joined: Jul 13, 2005
Posts: 21
I have a onsubmit() function in form tag for validating the required fields and I also have a onclick() function on the submit button for disable the button. How to stop the onclick function running when the validation function find the some required fields are empty ?

I have a problem that when user submit the form, the onsibmit function finds that some fields have not filled, and then the onclick function disable the button ! So that user cannot re-submit the request.

Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
why don't you have the onsubmit handler disable the button and not the onclick handler?

Eric
Usera User
Greenhorn

Joined: Jul 13, 2005
Posts: 21
Because I am using the struts validator. The onsubmit function is generated by the validation framework.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to stop the onclick function running when onsubmit validation fail