Question

I am trying to use Parsley.js for validate some form fields. After read the docs and see how I should use it I follow the next steps:

  • Add the attribute data-validate to form <form action="" id="product_create" method="post" data-validate="parsley">
  • Add the extra attributes to form fields <input type="text" id="product_price" name="product[price]" data-trigger="change keyup keypress" data-required="true" data-type="number">

If I don't understand bad so when I change the value of #product_price error should appears right? Well it doesn't and I can't find why or how I'm doing wrong, any advice

Était-ce utile?

La solution

I assume the issue is that you've entered some invalid value and expected parsley to come up with an error-msg when you left the field?

I'm currently struggling with that, too - and it seems to be that way "by design": https://github.com/guillaumepotier/Parsley.js/issues/262 Also the "classy demo" on http://parsleyjs.org/documentation.html does not validate when you immediately enter invalid data, it only does so when you try to send the form.

Anyway, I have opened an issue on https://github.com/guillaumepotier/Parsley.js/issues/385 and hope to understand the problem a bit better and maybe even get that changed ;-)

Autres conseils

I had the same problem and I solved it with data-validation-minlength="0"

For me, this error came from setting one of my input values to value='', which I know many people use. I found a workaround from that and it worked as it should.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top