title: rails form - 2 fields with same id in a form - how to disable second field when first field is selected
body: <p>I have in my rails form the following code:</p>
  
  <pre><code>&lt;label&gt;Fruit: &lt;/label&gt;  &lt;%= f.select(:IST_FRUIT, [['Apple', 'Apple'],
                            ['Orange', 'Orange'],
                            ['Kiwi', 'Kiwi'],
                            ['Other', 'Other']
                            ],{ :prompt =&gt; "Please select"},{:onchange =&gt; "if (this.value == 'Other') 
                                                                           {document.getElementById('otherTissue').style.display = 'block';
                                                                           } "}
                            ) %&gt;
  
  &lt;span id="otherFruit" style="display:none;"&gt; If other, please state: &lt;%= f.text_field :IST_FRUIT, :size =&gt; 10  %&gt;&lt;/span&gt;
  </code></pre>
  
  <p>User can select a fruit form the listbox but if user selects 'Other', a textfield is diaplayed allowing user to input his value.</p>
  
  <p>The problem is that when user selects a fruit and save the form, the fruit field in blank in the table and the reason is that the form is saving the second field 'IST_FRUIT' found in the span with id 'IST_FRUIT'.</p>
  
  <p>I would be really grateful if someone could show me a way how to disable the second field when 'other' is not selected and enable it when 'Other' is selected from the dropdown list.</p>
  
  <p>Many many thanks for any suggestion provided.</p>