You could actually just use the `PRE_SET_EVENT` to conditionally add the field with the "right conditional settings" instead of trying to change them later. Not the most elegant way to do it... but it's still doable. At least that's what I ended up doing in my case.
Hello Ryan. Not sure if this is the right place to ask ... I was wondering what is good way to debug an 'this field cannot be null' error that shows up in the main form ( form_errors(form) ) -- but not in any of the fields, with error_bubbling not set to true...
Debug it with Symfony Debug Toolbar - it's the best place I think. Also use custom validation messages i.e. "email cannot be null" instead of "this field cannot be null" - it'll be clearer.
6 Comments
You could actually just use the `PRE_SET_EVENT` to conditionally add the field with the "right conditional settings" instead of trying to change them later. Not the most elegant way to do it... but it's still doable. At least that's what I ended up doing in my case.
Don't sure about form events. I think Validation groups (http://symfony.com/doc/3.4/... or even validation group resolver (http://symfony.com/doc/3.4/... is more Symfony-way. Or Callback constraint (http://symfony.com/doc/3.4/....
Hello Ryan. Not sure if this is the right place to ask ... I was wondering what is good way to debug an 'this field cannot be null' error that shows up in the main form ( form_errors(form) ) -- but not in any of the fields, with error_bubbling not set to true...
Hey Nicolas,
Debug it with Symfony Debug Toolbar - it's the best place I think. Also use custom validation messages i.e. "email cannot be null" instead of "this field cannot be null" - it'll be clearer.
Cheers!
Thanks, the custom error messages worked perfectly !
Hello!
See what I've found related to Event Listener recipe:
http://stackoverflow.com/a/...
"Houston: no signs of life"
Start the conversation!