title: twig and boolean
body: <p>I have an Image class like this :</p>
  
  <pre><code>class Image {
  private $color;
  private $name;
  private $gradient;
  private $colorGradient;
  
  function __construct() {
      $this-&gt;color = "FFFFFF";
      $this-&gt;name = "blanc";
      $this-&gt;gradient = false;
      $this-&gt;colorGradient = "";
  }
  </code></pre>
  
  <p>in my controller I have this : </p>
  
  <pre><code>public function indexAction() {
      $image = new Image();
  
      $form = $this-&gt;createFormBuilder($image)
              -&gt;add('color', 'text')
              -&gt;add('name', 'text')
              -&gt;add('gradient', 'checkbox')
              -&gt;add('colorGradient', 'text')
              -&gt;getForm();
  
      return $this-&gt;render('CramifImageBuilderBundle:Builder:index.html.twig', array('form' =&gt; $form-&gt;createView()));
  }
  </code></pre>
  
  <p>in index.html.twig I have this :</p>
  
  <pre><code>&lt;form action="{{ path('cramif_image_builder_image_new') }}" method="post" {{  form_enctype(form) }}&gt;
          {{ form_errors(form) }}
  
          {{form_row(form.color)}}
          {{form_row(form.name)}}
  
          &lt;div id="gradient"&gt;
              {{form_row(form.gradient)}}
          &lt;/div&gt;
  
          {% if form.gradient == true %}
              &lt;div id="gradient_color"&gt;
                  {{form_row(form.colorGradient)}}
              &lt;/div&gt;
          {% endif %}
  
          &lt;input id="submit" type='submit' value='Créer' /&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>if gradient = true the checkbox is checked (good) with value='1'</p>
  
  <pre><code>&lt;input id="form_gradient" type="checkbox" checked="checked" value="1" required="required" name="form[gradient]"&gt;
  </code></pre>
  
  <p>if gradient = false the checkbox is not checked (good) with value = '1'</p>
  
  <pre><code>&lt;input id="form_gradient" type="checkbox" value="1" required="required" name="form[gradient]"&gt;
  </code></pre>
  
  <p>The problem is whatever the value of gradient, it like gradient is true : so the colorgradient field is always displayed</p>
  
  <p>Thank you </p>