magikeys
10-12-2011, 05:06 PM
I have a telephone input on my form. It is an optional input for users. The prompt begins with the user having to select a phone type from a select menu, and then continue to the text fields to enter the digits. I would like to have the text fields disabled unless any of the types of phone are selected, but not if a type isn't selected. Here's my HTML code so far:
<select name="phoneType1">
<option value="" selected="selected">Type...</option>
<option value="Home">Home</option>
<option value="Work">Office</option>
<option value="Cell">Cell</option>
</select>
(<input type="text" id="phAreaCode1" name="phAreaCode1" size="2" maxlength="3" onkeyup="moveOnMax(this,'phPrefix1')"/>) -
<input type="text" id="phPrefix1" name="phPrefix1" size="2" maxlength="3" onkeyup="moveOnMax(this,'phLine#1')"/> -
<input type="text" id="phLine#1" name="phLine#1" size="5" maxlength="4"/>
ext.<input type="text" name="phExtension1" size="4" maxlength="4"/>
I know that all I need to do to disable the text fields is to type in "disabled" before the name of the field. But, I don't know how to enable it when "Home," "Office," or "Cell" is selected. Thanks for any help.
<select name="phoneType1">
<option value="" selected="selected">Type...</option>
<option value="Home">Home</option>
<option value="Work">Office</option>
<option value="Cell">Cell</option>
</select>
(<input type="text" id="phAreaCode1" name="phAreaCode1" size="2" maxlength="3" onkeyup="moveOnMax(this,'phPrefix1')"/>) -
<input type="text" id="phPrefix1" name="phPrefix1" size="2" maxlength="3" onkeyup="moveOnMax(this,'phLine#1')"/> -
<input type="text" id="phLine#1" name="phLine#1" size="5" maxlength="4"/>
ext.<input type="text" name="phExtension1" size="4" maxlength="4"/>
I know that all I need to do to disable the text fields is to type in "disabled" before the name of the field. But, I don't know how to enable it when "Home," "Office," or "Cell" is selected. Thanks for any help.