ruby - Enable/disable the custom field when another custom field is selected -
i need disable 1 custom field when other custom field selected. example, have custom field dropdown format. when click on 2nd option of particular custom field,the other custom field should disabled , 1 more custom field should enabled. how do in redmine
?
as understood wanted change option of 2nd dropdown box on bases of 1st dropdown's option selection:
this sample code perform same using jquery. can modify per requirement.
html
<select class="product" id="select_1" name="product"> <option selected="selected" value=""> choose category </option> <option value="mens suits"> mens suits </option> <option value="womens suit"> womens suits </option> <option value="children suit"> children suits </option> </select> <select class="size" id="select_3" name="size"> <option selected="selected" value=""> choose size </option> </select>
jquery:
var men = '<option selected="selected" value=""> choose size </option><option value="36">36</option><option value="38">38</option><option value="40">40</option>'; var women = '<option selected="selected" value=""> choose size </option><option value="26">26</option><option value="28">28</option><option value="30">30</option>'; var children = '<option selected="selected" value=""> choose size </option><option value="12">12</option><option value="11">11</option><option value="10">10</option>'; $(document).ready(function(){ $("select#select_1").on('change',function(){ if($(this).val()=="mens suits"){ $("select#select_3").html(men); }else if($(this).val()=="womens suit"){ $("select#select_3").html(women); }else if($(this).val()=="children suit"){ $("select#select_3").html(children); } }); });
working demo
i hope helps you. :)