3
I’m making a jquery.validate
, can make max dynamically,
something like:
...
max: function () {
return $('#QtdEstoqueHidden').val();
...
ok, it worked! (I store the max value in a Hidden field that is dynamically replaced by an ajax on the page)
Now I want to make that depending on a <select>
that max
be ignored.
I tried to make him ignore the validation, but I could not, so I tried to make a max = 999999999 would be enough as if ingorasse. but I could not. Now he always releases the form.
Follow the jsfiddler https://jsfiddle.net/dorathoto/9nmzntqs/2/
Buddy, your fiddle doesn’t work yet either.. If I select the Limit Max option, it should limit the value I type, in your example although the max is 43 accepted 32412312, and if I select unlimited.. then he should ignore.
– Dorathoto
it validates and drop an exception and does not allow to continue with the form Ubmit... or you that it does not allow to enter any number greater than the stipulated?
– Eduardo Breno
If you can change the attribute
max
of inputtype='number'
according to the conditions that suit you.– Eduardo Breno
vc did not understand.. I am typing 10000 in the input field and it is accepting.. max is not validating when it should validate
– Dorathoto
Strange, but I think I solved, he does not directly accept the return of
$().val()
, put aparseInt
, I updated the code, see if it fits.– Eduardo Breno
see, https://s3.postimg.org/l8n6o8roj/Limitar.png although it’s like Limit Max it’s letting me type a higher number than max.
– Dorathoto
It displays the message when it loses input focus: https://postimg.org/image/jaf1bpy47/
– Eduardo Breno
on my Chrome does not show that! I can even click send button.
– Dorathoto
Are you testing the snippet in the stackoverflow response, where is the exception button? The code is just an example to demonstrate functionality, you must adapt it to your need.
– Eduardo Breno
no, no fidller q vc posted, ops...was wrong.. I will test.
– Dorathoto