symfony - Symfony2 form: no empty choice -
building symfony2 form choices, there option "empty value", set text related empty choice.
however, want set choice field mandatory, empty value should displayed no choosen. using empty or null constraints, there no error when user send "" value. how should done?
you can add notblank()
validation constraint appropriate property in form's underlying entity.
how depends on whether using annotations or yaml validation definitions.
there information validator here:
http://symfony.com/doc/current/reference/constraints/notblank.html
hope helps :)
Comments
Post a Comment