PDA

View Full Version : disabled text fields


JackFruit3D
11-10-2002, 09:03 PM
I have a simple option list
<option value=1>1</Option>
<option value=2>2</Option>
<option value=3>3</Option>
<option value=custom>Custom</Option>

and a simple text box

<input type=text DISABLED name="textbox1">

when the user selects the custom value i want to be able to remove the disabled feature of the text box so ppl can type their custom value in it.

chrismiceli
11-10-2002, 09:40 PM
i use this to disable and enable a text field
<input type="text" value="" name="hi" disabled="true">

document.forms[0].hi.disabled = 1 //or true, but no quotes or it doesnt' work
document.forms[0].hi.disabled = 0 //or false

whammy
11-10-2002, 11:40 PM
if(document.forms[0].selectname.selectedIndex == 3){
document.forms[0].textbox1.disabled = false;
}

Remember that selectedIndex starts with 0. so 0,1,2,3. :)