I am using form builder without class and have two fields with each having constraints :
$form = $this->createFormBuilder()
->add('name', 'text', array(
'required'=>false,
'constraints'=> new Length(array('min'=>3)
))
->add('dob', 'date', array(
'required'=>false,
'constraints'=> new Date()
))
->getForm()
->handleRequest($request);
This works great but I want to check if both fields are emtpy, and display error. Just can't seem to get a handle on this. Could someone provide help???
the easiest solution is to just set both as required ...
but.. on post you could check as simple as
the symfony way would possibly be adding a custom validator I suggest you to look at custom validator especially this part
pseudo :