Friday, 15 February 2013

symfony - Symfony2 form: no empty choice -


An option to set a Symfony2 form with the option, setting an empty option for text is "empty value",

However, I want to set my choice field as compulsory, so empty values ​​should be displayed, but none has been selected. Using empty or zero barriers, there is no error when the user sends the "value". How should this be done?

You can add a NotBlank () verification

< P> How you do this depends on whether you are using Annotation or YML for your validity definitions.

There is some information about the validator here:

Hope this helps :) :)


No comments:

Post a Comment