title: How can i change checkbox in rails?
body: <p>How can i set a check box to true or false.. I have tried all of these combinations:</p>
  
  <pre><code>&lt;%= check_box_tag 'prefs[can_be_email_notified]', :id =&gt; 'user_preferences_can_email'%&gt; Email 
  &lt;%= check_box_tag 'prefs[can_be_email_notified]', '', :id =&gt; 'user_preferences_can_email'%&gt; Email
  &lt;%= check_box_tag 'prefs[can_be_email_notified]', '', :checked =&gt;'',:id =&gt; 'user_preferences_can_email'%&gt; Email
  </code></pre>
  
  <p>tried to change the checkbox with these</p>
  
  <pre><code>document.getElementById("user_preferences_can_email").checked = true;
  document.getElementById("user_preferences_can_email").value = true;
  document.getElementById("user_preferences_can_email").checked.value = true;
  </code></pre>
  
  <p>Maybe i wasnt clear... </p>
  
  <p>I have a set of values that are set to buttons and want to change the checkbox's to be checked or unchecked detirmed on the value set on the the button,</p>
  
  <p>ie:</p>
  
  <pre><code>function doubleClickUser(can_email, can_screen) {
          document.getElementById("user_preferences_can_email").checked = can_email;
          document.getElementById("user_preferences_can_screen").checked = can_screen;
  }
  
  &lt;button class="button" onclick="doubleClickUser('true','false')"&gt;&lt;%= user[:email] %&gt;&lt;/button&gt;
  
  &lt;%= check_box_tag 'prefs[can_be_email_notified]', :id =&gt; 'user_preferences_can_email'%&gt; Email
  &lt;%= check_box_tag 'prefs[can_be_screen_notified]', :id =&gt; 'user_preferences_can_screen' %&gt; Screen
  </code></pre>