Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to stop the onclick function running when onsubmit validation fail

 
Usera User
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why don't you have the onsubmit handler disable the button and not the onclick handler?

Eric
 
Usera User
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because I am using the struts validator. The onsubmit function is generated by the validation framework.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic