Jump to content

Halfway home... Making disabled SELECT option become active


galvin

Recommended Posts

I think I am close, but need some help to finish.  It the HEAD of  my page, I have...

 

<script language="javascript">
function enableField()
{
document.getElementById("ounces").disabled=false;
}
</script>

 

Then further down, I have these two select fields in a form...

 

 

 

<td> <select name='pounds'><option value='0'>Choose Pounds</option>  
<option value='4'>LESS THAN 5 pounds</option> 
<option value='5'>5 pounds</option> 
<option value='6'>6 pounds</option> 
<option value='7' selected='selected'>7 pounds</option> 
<option value='8'>8 pounds</option> 
<option value='9'>9 pounds</option> 
<option value='10'>10 pounds</option> 
<option value='11'>11 pounds</option> 
<option value='12'>MORE THAN 11 pounds</option> 
</select>
</td><td> <select name='ounces' id='ounces' disabled='true'>    <option value='0'>Choose Ounces</option> 
<option value='0' selected='selected'>0 ounces </option> 
<option value='1'>1 ounces </option> 
<option value='2'>2 ounces </option> 
<option value='3'>3 ounces </option> 
<option value='4'>4 ounces </option> 
<option value='5'>5 ounces </option> 
<option value='6'>6 ounces </option> 
<option value='7'>7 ounces </option> 
<option value='8'>8 ounces </option> 
<option value='9'>9 ounces </option> 
<option value='10'>10 ounces </option> 
<option value='11'>11 ounces </option> 
<option value='12'>12 ounces </option> 
<option value='13'>13 ounces </option> 
<option value='14'>14 ounces </option> 
<option value='15'>15 ounces </option> 
</select>
</td>

 

How can I make it so the "ounces" select option gets set to "disabled=false" (i.e. becomes ACTIVE) when the visitor chooses any of the "Pound" values between 5 and 11.

 

Basically, when the page is loaded, the ounces dropdown is INACTVE.  If they choose either "LESS THAN 5 POUNDS" or "MORE THAN 11 POUNDS", there is no reason to select ounces, so it stays disabled.  but if they choose any of the other pound values, I need ounces to become an ACTIVE option so they can select ounces too.

 

Any ideas?

 

Greg

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.