I want to disable textbox depending on option selected in listbox in rails 3
I have the code for select and text box
<%= f.select "type_id", options_from_collection_for_select(@types, "type_id","name")%>
<%= f.text_field :zonetype %>
-
It displays the list of types
-
I want to do is if I select no type the text box following the select must be disabled
How to do this please help me….
You will need to use jQuery or similar to find the change event of your select box, something like:
The “selector” would be a jQuery selector that finds your select list (probably by ID).
The “do-stuff” would be setting the text field to disabled, this would look something like:
This time the “selector” would be a jQuery selector that finds your text box (probably by ID).