galvin Posted January 30, 2010 Share Posted January 30, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/190351-halfway-home-making-disabled-select-option-become-active/ Share on other sites More sharing options...
jskywalker Posted January 30, 2010 Share Posted January 30, 2010 <select name='pounds' onblur="doSomehtingWhenFieldIsLeft();" onChange="doSomethingWhenFieldIsChanged();"> and create the javascript-code to do what you want... Quote Link to comment https://forums.phpfreaks.com/topic/190351-halfway-home-making-disabled-select-option-become-active/#findComment-1004249 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.