title: Pass javascript variable to twig form_widget FOSymfony
body: <p>I want to set the array of form_widget in twig using some localStorage variables which i have saved in javacript variables.</p>
  
  <p>Which is the best way to do this?</p>
  
  <p>I tried getting the ID of the input field and setting the value with jquery from js but it's not working</p>
  
  <pre><code>&lt;div class="col-sm-3 year"&gt;
               {{ form_widget(form.birthdate.year, {'value': 'birthdate.year'}) }}
            &lt;/div&gt;
  </code></pre>
  
  <pre><code>&lt;script&gt;
     var birthdateJSON = localStorage.getItem('user_birthdate');
     var birthdate = JSON.parse(birthdateJSON);
  &lt;/script&gt;
  </code></pre>