guillaumepotier / Parsley.js

Validate your forms, frontend, without writing a single line of javascript

Home Page:http://parsleyjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

xxvii opened this issue · comments

commented

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.

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