Related questions
Symfony2 Setting a default choice field selection
I am creating a form in the following manner:
$form = $this->createFormBuilder($breed)
->add('species', 'entity', array(
'class' => 'BFPEduBundle:Item',
'property' => 'name',
'query_builder' => function(ItemRepository $er){
return $er->createQueryBuilder('i')
->…
Add error to Symfony 2 form element
I check some validation in my controller. And I want to add error to specific element of my form on failure. My form:
use Symfony\Component\Form\FormError;
// ...
$config = new Config();
$form = $this->createFormBuilder($config)
->add('googleMapKey', …
Simple check if form field has errors in Twig template
In Twig template I check if a field has an error like this:
{% if form.points.get('errors') is not empty %}
Is there any method like:
{% if form.points.hasErrors() %}
to do it simpler? It's not a big difference, but …