I'm trying to enable / disable a text field based on a user selecting a specific option in a multiple select list. The value of the item that I want to base the enabling / disabling from is value 11.
I have the code below, but it doesn't seem to work when more than one item is chosen.
Any help is appreciated.
- Rieekan
I have the code below, but it doesn't seem to work when more than one item is chosen.
Code:
function OtherEnablement() {
var list = document.forms[0].key_initiative;
if ( ! list.options ) return;
var value = list.options[list.selectedIndex].value;
var otherDisabled = (value != '11');
var field = document.getElementById('initiative_other');
field.disabled = otherDisabled;
if (field.disabled) field.value = '';
var label = document.getElementById('initiative_other');
label.disabled = otherDisabled;
}
Any help is appreciated.
- Rieekan