title: Rails: Hide form field when value is popuated
body: <p>I have this form.  When the object has a value for gender, I want to change the gender field to a hidden field, so the user does not need to see it. What is the best way to do this?</p>
  
  <pre><code>    &lt;%= form_for( object ,:html =&gt; {:class =&gt; "form-horizontal"}) do |f| %&gt; 
         &lt;div class="form-group row"&gt;
            &lt;%= f.label(:first_name, :class =&gt; "control-label col-xs-4 input-lg") %&gt;
  
              &lt;div class="form-inline col-xs-8"&gt;
                  &lt;div class=""&gt;
                      &lt;%= f.text_field( :first_name,{class: "form-control input-lg"}) %&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group row"&gt;
            &lt;%= f.label(:last_name, :class =&gt; "control-label col-xs-4 input-lg") %&gt;
  
              &lt;div class="form-inline col-xs-8"&gt;
                  &lt;div class=""&gt;
                      &lt;%= f.text_field( :last_name,{class: "form-control input-lg"}) %&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
       &lt;div class="form-group row"&gt;
            &lt;%= f.label(:gender, :class =&gt; "control-label col-xs-4 input-lg") %&gt;
              &lt;div class="col-xs-8"&gt;
              &lt;%= f.select( :gender, Dropdown.gender,{:prompt =&gt;"Please Choose"},{class: "form-control input-lg"}) %&gt;
              &lt;/div&gt;
          &lt;/div&gt;
              &lt;div class="col-xs-8 col-xs-offset-4"&gt;
                 &lt;%= f.submit object.submit_button_name, {class: 'btn btn-lg'} %&gt;
              &lt;/div&gt;
  
      &lt;% end %&gt;
  </code></pre>