-
Notifications
You must be signed in to change notification settings - Fork 68
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
Validation plugin tires to validate all enabled elements #20
Comments
Hi @farrukhsubhani, Stepy validates the hidden fields because you can click to jump 3 step ahead, then all steps behind, that is hidden, should be validate to be continue. Maybe we can just validates hidden fields, in that case when is possible jump steps by title click. |
Most ruby and mvc asp.net framework generate a hidden field for checkboxes and using jquery validation plugin we can put in ignore case however in stepy the above line takes all enabled inputs. I have changed it to use opt.ignore string to respect ignore option. Which is same for validation plugin as well. |
I have an anger about jQuery Validation about the hidden validation by default. |
Thinking about jumping more than one step and validating whole form. You can have an option flag in opt.vaidateall when true will not filter the fields. There are two things here. 1. Validating fields and 2. Missing a step by jumping more than one. If you seperate these two concerns then its easy to see why validation is actually not needed on hidden fieds. For example you have steps array which you can also have step.status for each step as a property. Initialize it to 0. When you make your step visible you dont need to set it to anything. But when someone jumps to another step you can mark the leaving step as -1 if invalid and 1 if valid and check if the last step index is current index - 1 then its not a jump else loop through all step indexes in between and mark them as -1 because they were skipped.
All of these can have css classes to be set or not to reflect step status. This way you only rely on jquery validation when required. Let me know if you think the approach is not right. |
When a step is active most of the time its just that step that needs to be validated so you can change the line
to read
This will only validate visible elements and not hidden steps. If you want more flexibility add a flag to properties for validatehidden:false and if someone wants that function they can set it to true (but i cant see any point of validating hidden fields)
The text was updated successfully, but these errors were encountered: