4

I am using jQuery validation on my form and I would like to be able to disable the submit button and change its class, when the form validates. I know I could bind a function on the key up event but I want to know if this is possible from within the jQuery validate framework. I tried doing what this guy suggested, but got nowhere.

I am using jQuery Validate

Community
  • 1
  • 1
Russ Bradberry
  • 10,705
  • 17
  • 69
  • 85

1 Answers1

4

It appears that you may be able to get this to work automatically within the options on the Validate plugin itself.

Check out this link on the jQuery docs for more information.

$("myForm").validate(
   {
       onkeyup: true, 
       onsubmit: false, 
       onclick: true, 
       onfocusout: true
   }
);
RSolberg
  • 26,821
  • 23
  • 116
  • 160
  • As per the documents you referenced, _"a boolean `true` is not a valid value"_ for any of these listed options. You can only set them to `false` or over-ride them with a custom function. However, these are already the default behaviors so setting any of them to `true` is not only unnecessary, it could potentially break this plugin. – Sparky Oct 27 '14 at 00:48
  • @Sparky - This question is 4 years old. Documents change! Rather than vote down an answer, you ought to edit it. make it right. – RSolberg Oct 27 '14 at 19:40
  • [I will not edit an answer if it makes _"the code do something different than what the answer says it does"_](http://meta.stackoverflow.com/a/260246/594235) or like here, I'd have to rewrite the entire answer. However, I did let you know exactly what this issue is so you'd have every opportunity to fix it yourself. Once fixed, I'll always reconsider retracting any down-vote I may have cast, and even up-vote if/when appropriate. In this case, even four years ago, these options were documented and functioned the same as today. – Sparky Oct 27 '14 at 22:01