Validate checkbox not mapped to entity in a symfony2 form
NotBlank
validates string to be not empty. Try to use NotNull
IsTrue must also works.
Validates that a value is true. Specifically, this checks to see ifthe value is exactly true, exactly the integer 1, or exactly thestring "1". This constraint can be applied to properties (e.g. a termsAccepted property on a registration model).
Updated answer for Symfony 3.0:
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;use Symfony\Component\Validator\Constraints\IsTrue;// ...{ $builder->add('terms', CheckboxType::class, array('constraints'=>new IsTrue(array('message'=>'Needs to be clicked')));}