New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
don't validate hidden fields #189
Comments
you can do it by setting the ignore option in the config like this: |
How about making ":hidden" the default for the ignore option? That way it can be overriden, but doesn't have to be set all the time. |
Hi, This default option is not good, because hidden fields are valid field and can be submitted. On the other hand, validate hidden fields prevents the user defrauds the form when it is not showed like on jQuery Stepy on a Wizard form. If you don't want validate the hidden field, simple, just do not put a rule in this field. |
i think.. |
Yes, of course my friend, read again, "[..] just do NOT put a rule in this field" If you don't put a rule on hidden field, it wont be validate. On the other hand this default broke the code: #263 |
I just spent two hours trying to figure out why was my field ignored.
I've put class="required" in it, why no validation?
And still no validation. I thought to myself: "why not validate those fields? if you don't want something validated, you simply don't put class="required" there.." At that point I was breathing fire and went to the sourcecode, then to changelog and here. Looking at #263, this looks like a rather ugly hack than a solution to the original problem. |
How about overriding the default ignore settings? it could read ":hidden:not(.required)" and you're good. |
Hi hakunin, This "ugly" code is to avoid If you have an better solution for the error, do a push. (; |
If I make a field required, I expect that because of this it will be validated. The visibility of that field should not come into question at all. This change breaks a TON of code... anything in a collapsed accordion, anything in a tab that is not in focus. If I've taken the time to annotate a field to be validated, it should be validated. |
@muldera it's not that simple. What do you do if it's invalid? The user will have no idea, so why don't you just show it by default? If you really want the original behavior just set |
I see this as a very bad idea. If a field is marked as required, it should be validated, whether hidden or not. Visibility and validation should have no default relationship to each other. There are countless places that hidden fields are validated. Think of all the required fields that are "hidden" inside tabs and accordion controls. This was not well thought out. The burden should be on those who DON'T want to validate hidden fields. |
Well this change was made 9 months ago and has had little in the way of complaints until now. It's very easy to set |
The problem cames again, as I said. Via iPhone On 17/05/2012, at 18:50, ctsears
|
I think there are merits for keeping the default, but I also think the official tabs demo shows that I still don't see what the big deal is with setting |
Agreed. It's very easy to set the ignore option in every page that relies on hidden, required fields. I just think it's silly that we have to do it. It's just as easy to set this in every page that you don't want to validate hidden fields. You've just placed the burden on everyone else. You've tied validation to visibility by default. That just feels backward IMHO. |
In case my $1/50 matters... I agree that hidden elements SHOULD be validated. I am working a SPA, forms often have multiple tabs, along with logic which may hide / show fields based on other fields. My vote: default don't exclude hidden elements. |
Thanks for the feedback @bsingin64. Based on the number of issues since 2006 and since the change nine months ago, I tend to think that the current default is the better choice. Neither approach is good enough, so unless we can come up with a solution that avoids the issue entirely, I'd like to stick with what we have now. Better demos and documentation could certainly help address the issue, but that's just not possible with the current state of affairs. I need a sponsor for the project to focus on more then just addressing critical bugs. |
Is it still possible to allow validation of hidden fields by setting ignore: "" ?
I have that tag in my page but hidden fields are still being skipped. |
@TheCrow1213 could you please open a new issue and link a small jsfiddle which shows a reduced example of the problem? |
@staabm Got it working. I'm not sure how... but it is. Thanks :) |
Realise that this change is handy for tabs/etc. but just wanted to echo the opinion that the default option should be to validate everything and then, if you particularly don't want to validate elements that aren't visible, you can add an ignore option. I'd much rather debug an error caused by elements that are not visible requiring validation than wondering why some elements that are very clearly marked as |
@steveharrison we cannot change the selector to affect more elements as it does atm with breaking BC. We can discuss this for a possible 2.x version, but this will not be something happening in the near future |
Hi, |
Please open a new issue or ask the question on stackoverflow. |
Hi, i change the function:
to:
to not validate hidden fields.. (in my case, sometimes a field will be hidden in the submit).
is this a valid change to the project?
The text was updated successfully, but these errors were encountered: