vurtman
04-22-2003, 04:47 PM
basically if form1.select4 is 2 or 3 then default form1.select5 to 2 and make that selection 'unchangeable'.
|
Click to See Complete Forum and Search --> : change drop down list based upon other selection vurtman 04-22-2003, 04:47 PM basically if form1.select4 is 2 or 3 then default form1.select5 to 2 and make that selection 'unchangeable'. khalidali63 04-22-2003, 05:04 PM though the description in your question is ..lets just say "vague" but looking at the title of the thread,try this links.. http://68.145.35.86/skills/javascripts/MultipleListBoxResult3rdListBox.html Jona 04-22-2003, 05:10 PM Taken from HTMLGoodies.com: <!doctype html public "-//w3c//dtd html 4.0//en"> <html> <head> <title>If This, Then That</title> </head> <body bgcolor="ffffcc" text="000000" link="0000ff" vlink="800080" alink="ff0000"> <CENTER><TABLE BORDER="0" WIDTH="400" cellpadding="10"><TR><TD BGCOLOR="FFFFCC"> <h2>If This, Then That: Changing Selectbox Choices</h2> <script language="JavaScript"> function YesAnswer() { var IntPath = document.joe.burns; var TheOptions = IntPath.options.length; document.joe.burns.options.length = 0; IntPath.options[IntPath.options.length] = new Option('His Hair is Cool','0'); IntPath.options[IntPath.options.length] = new Option('I am taken away by his dreamy Vocals','1'); IntPath.options[IntPath.options.length] = new Option('He commands me to like him','2'); } function NoAnswer() { var IntPath = document.joe.burns; var TheOptions = IntPath.options.length; document.joe.burns.options.length = 0; IntPath.options[IntPath.options.length] = new Option('No Need to Answer. Go On. ','0'); } </script> </center><P> <P><HR WIDTH="80%"><P> <CENTER><Table border="0"><TD> <FORM NAME="joe"> <b>Do You Like Barry Manilow?</b><BR> <INPUT TYPE="radio" NAME="zork" VALUE="yes" onClick="YesAnswer()"> Yes<BR> <INPUT TYPE="radio" NAME="zork" VALUE="no" onClick="NoAnswer()"> No<P> <b>Why? </b><SELECT NAME="burns"> <OPTION SELECTED> Waiting for response from above </SELECT> </FORM> </TD></TABLE></CENTER> <P><center>[<A HREF="sectiontwo.html">Back to the Index Page</A>]</center> </TD><TR></TABLE></CENTER><P> </body> </html> vurtman 04-22-2003, 09:43 PM I guess i was looking for something simpler. My document is an asp page and the drop down lists are populated via a database so I am not interested in 'dynamic drop down lists" but rather setting the value of a drop down list based upon the value of another drop down list. For example, here is a current use: <select name="select3" onChange="chkAction(value)"> <%Do Until rs3.EOF%> <option value="<%=rs3("reason_id")%>"><%=rs3("reason")%></option> <%rs3.MoveNext%> <%Loop%> </select> So I am using the onChange to call the javascript "chkAction(value) and my javascript for this is this: else if (form1.select3.value == "none") { window.alert("Please choose a valid answer for the Reason") return false I am just checking for a null entry in that field and reminding the user they need to value that field. ----------------------------------- So I want to do the same concept with this subject I have posted. If The dropdown list 3 is either "2" or "3" then value drop down list (select 5) to the value "1". That is the goal and I want to 'call' the javascript when the value of a particular drop down list changes as I have done above. Sorry for the poor description on the post. DrDaMour 04-22-2003, 10:07 PM document.formname.selectname.length is the number of options document.formname.selectname.value is the actual value of the option document.formname.selectname.text is the text that is displayed in the select box. i'm not totally sure i understand your chkAction function but the value you want to pass to yoru function is document.formname.selectname.options[document.formname.selectname.selectedIndex].value using the this pointer you can make it a little smaller chkAction(this.options[this.selectedIndex].value) from there you could check the value against things and then populate the second select box with availible answers webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |