guillaumepotier / Parsley.js

Validate your forms, frontend, without writing a single line of javascript
http://parsleyjs.org
MIT License
9.05k stars 1.32k forks source link

Parsley validates all steps in multi steps form if button doesn't have type="button" #1364

Closed xxvii closed 2 years ago

xxvii commented 2 years ago

What kind of issue is this? (put 'x' between the square brackets)

I just spent a ridiculous amount of time trying to figure out why Parsley would validate all inputs in all steps of the form when I click the "Next" button in the first step, instead of validating only the inputs inside the first step.

Here is a reduced test case, the code is exactly the same as here https://parsleyjs.org/doc/examples/multisteps.html, I only removed type="button" from the Next button. https://codepen.io/Stanza27/pen/rNGLRqJ

If you add type="button" again, or if you use another tag instead of button (a, span, whatever...) everything works.

It's not strictly Parsley fault, because the type attribute should be mandatory for the button tag, but I have the feeling that it should work in any case.

At least add a big red warning in the documentation and in the examples. Thank you, sorry for the rant.

marcandre commented 2 years ago

It's not strictly Parsley fault, because the type attribute should be mandatory for the button tag, but I have the feeling that it should work in any case.

I'm sorry you wasted time and I agree with you that the fact that the default type for a <button> is submit is a very dubious choice of the HTML standard. If you'd like a note to that effect incorporated somewhere in the docs / example page, please open a PR.

Good luck