Skip to content

[Form] Add "validate" option to buttons which sets formnovalidate and disables validation #8763

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

Closed
webmozart opened this issue Aug 15, 2013 · 6 comments

Comments

@webmozart
Copy link
Contributor

The title says it all :)

@webmozart
Copy link
Contributor Author

The same option should be added to normal forms. When "validate" is set to false, no validation should occur (i.e. FormValidator::validate() should be skipped, which is not the case for "validation_groups" => false).

@fancyweb
Copy link
Contributor

Skipping children validation independently doesn't look easy on first sight since only the root form is validated with a @Valid constraint.

xabbuh added a commit that referenced this issue Sep 23, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[Form][SubmitType] Add "validate" option

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | #8763
| License       | MIT
| Doc PR        | TODO

The second part of the ticket requires more work but is kind of unrelated.

Commits
-------

a2bc06d [Form][SubmitType] Add "validate" option
@xabbuh
Copy link
Member

xabbuh commented Jun 4, 2020

When implementing this option on any form type, we will need to document that its value is only evaluated on root forms (this would be an additional check in the ValidationListener before starting the validator).

While not cascading validation into nested forms would be possible now with the recent changes made in the FormValidator class allowing that would lead to inconsistent and confusing results as constraints attached to the underlying data class would still be evaluated independently and their constraint violations would be added to form fields that the developer didn't intend to be validated (some time ago I wrote a bit more on this topic in #30094).

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@carsonbot
Copy link

Just a quick reminder to make a comment on this. If I don't hear anything I'll close this.

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants