-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] [Validator] GraphWalker doesn't validate all groups #5066
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
Comments
This is exactly what the GroupSequence is about: validating some groups only if the previous ones passed |
How should one implement conditional validation, without using GroupSequenceProvider? I don't want my user to fill out the form on trial and error. Depending on the data he fills out, I want to completely validate the form. |
What do you mean by conditional validation ? |
Well, simplified my use case: I have a form with text fields: firstname, lastname, a checkbox for "I want to use a voucher" and another textfield "voucher code". The real form has a lot more fields and validators, so using the Callback validator is not an option. |
Conditional validation is not built into the core, as there are a lot of possibilities that we cannot cover all. You should use a dynamic validation routine instead, either by defining your own custom constraint, by using the Callback constraint or by constraining a custom validation method with True or False. |
I have implemented a
GroupSequenceProviderInterface
on my entity as described here: #3199When the
getGroupSequence()
method returns more then one group and the first group triggers a violation, the second (or later) groups don't get validated anymore. This happens in the GraphWalker:Is this on purpose? I think it is strange a user gets different error messages depending on the groups he filled out on the form. In my use case the user first receives 4 errors. After fixing the errors and a submit he receives another 2 errors.
The text was updated successfully, but these errors were encountered: