I am trying to enable/disable text fields based on what the user selects from a drop down list. if the user selects email then only the email field will be available to the user and so forth for the other fields. I am new to JS and could use some help. thanks <form action="nextalumni.php" method="post" name="alumni"> <label>† If yes to the above question, how may we contact you?</label> <select name="Method" id="Method_Select"> <option value="" selected="selected">--</option> <option value="Email" >Email</option> <option value="Phone">Phone</option> <option value="Mail">Mail</option> <option value="Email&Phone">Email & Phone</option> <option value="Email&Mail">Email & Mail</option> <option value="Phone&Mail">Phone & Mail</option> <option value="All">All methods</option> </select> <input name="Email" type="text" size="35" /> <input name="Address" type="text" size="35" /> <input name="City" type="text" size="25" /> <select name="State" > <option value="" selected="selected">Choose a State</option> <option value="UNK">Outside US / Canada</option> <option value="AL">Alabama</option> </select> <input name="Zipcode" type="text" size="15" /> </form> Code (markup): I shortened the state option just to keep the post short again thanks
Not tested.!!! <form action="nextalumni.php" method="post" name="alumni"> <label>† If yes to the above question, how may we contact you?</label> <select name="Method" id="Method_Select"> <option value="" selected="selected">--</option> <option value="Email" onclick="document.getElementById('Address').disabled=true;document.getElementById('City').disabled=true;">Email</option> <option value="Phone">Phone</option> <option value="Mail">Mail</option> <option value="Email&Phone">Email & Phone</option> <option value="Email&Mail">Email & Mail</option> <option value="Phone&Mail">Phone & Mail</option> <option value="All">All methods</option> </select> <input name="Email" id="Email" type="text" size="35" /> <input name="Address" id="Address" type="text" size="35" /> <input name="City" id="City" type="text" size="25" /> <select name="State" > <option value="" selected="selected">Choose a State</option> <option value="UNK">Outside US / Canada</option> <option value="AL">Alabama</option> </select> <input name="Zipcode" type="text" size="15" /> </form> Code (markup):