-
Notifications
You must be signed in to change notification settings - Fork 26
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 groups (and buttons) #4
Comments
Sorry but i'm not sure what you mean with this issue. If you are using a bundle to create the steps please let me know which one and is possible create a gist with a example of the code you are using. If you are doing a prev/next in the html with one form then I don't think you need to use any validation groups or buttons. Since you can do all of this using javascript event handlers on the buttons. Just to clarify:
|
Thank you for your help! I added the |
Ok i get your point you wish to change the active validation groups using javascript. This is currently not possible but can made possible. Then again I'm pretty sure you should just not use validation groups in this way since jquery can ignore none visible fields. Removing the var nextPanel = function () {
if ($('form').valid()) {
$('.first').slideUp();
$('.second').slideDown();
}
} |
Well here's something funny. The code you suggested only works if all the js code is loaded in the Here is the updated fiddle http://jsfiddle.net/scottgutman/gxm0twev/ Why would it matter where the script is loaded? |
---EDIT: ignore this comment, as it's not exactly the problem. form.find("*[name=\"scs_intakebundle_intake\x5Bsubmit\x5D\"]").click(function () {
groups = {
"Default": true,
"firstPanel": true
};
}); Validation then works. I removed the validation groups, but this code is still generated for the |
I was looking into the file: form_validate.js.twig. I noticed that enforce_validation_groups was true even though all of them were removed. Then in JqueryValidationExtention.php, I noticed that enforce_validation_groups is controlled by the number of buttons on the form: Question: Won't every form have at least 1 submit button? So I changed the |
Thanks very much for all your feedback and research. I just pushed a bunch of fixed based on this issue. Please do a composer update (using dev-master) and good luck. If you encounter any more issues please report them 😄 |
Thanks for this bundle, it's really useful.
I would like to know how I could use validation groups and buttons with this bundle.
For example, suppose that only part of a form is visible, and there are "next" and "previous" buttons.
How would I be able to do "group validation" on the next button, and all validation on submit?
I tried to just add some additional JS code, but the validator is out of scope since it's encapsulated in a function closure. Could we maybe add the option to have the validator in the global scope?
The text was updated successfully, but these errors were encountered: