| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| I am not sure if this should be posted in a Java forum, bit it does concern asp. I have the following script on my asp (classic) page. <html> <head> <title>Example combo box</title> <script language="javascript"> <!-- function dept_onchange(frmSelect) { frmSelect.submit(); } //--> </script> </head> <body> <form name="frmSelect" method="Post" action="select.asp"> <SELECT name=courses LANGUAGE=javascript onchange="return dept_onchange(frmSelect)"> <% Set oRs=Server.CreateObject("adodb.recordset") strSQL = "SELECT Status_ID, Staff_ID, firstlastName FROM staff WHERE Status_ID=1 Or Status_ID=19 ORDER by firstlastname" oRs.Open strSQL, conn Do while not oRs.EOF if Request.Form("courses") = oRs("firstlastName") then 'if this is the selected one then display as selected Response.Write "<OPTION VALUE = '" & oRS ("staff_ID") & "' SELECTED>" Response.Write oRs("firstlastName") & "</Option>" oRs.MoveNext else Response.Write "<OPTION VALUE = '" & oRs ("Staff_ID") & "'>" Response.Write oRs("firstlastName") & "</Option>" oRs.MoveNext end if loop The script works fine, it lists the firstlastname field from the access 2k database and places the corrasponding staff_ID value in Request.Form("courses"). What I would like to do is display the selected firstlastname value in box further down the page. I would appreciate it if anybody could help with, what looks like, a simple task. |
|
#2
| |||
| |||
| "paulmitchell507" <paulmitchell507@googlemail.com> wrote in message news:dfb4f1cf-382a-4362-bd71-95364994694e@z66g2000hsc.googlegroups.com... > I am not sure if this should be posted in a Java forum, bit it does > concern asp. > I have the following script on my asp (classic) page. > > <html> > <head> > <title>Example combo box</title> > > <script language="javascript"> > <!-- > > function dept_onchange(frmSelect) { > frmSelect.submit(); > } > > //--> > </script> > </head> > <body> > <form name="frmSelect" method="Post" action="select.asp"> > <SELECT name=courses LANGUAGE=javascript onchange="return > dept_onchange(frmSelect)"> > <% > Set oRs=Server.CreateObject("adodb.recordset") > strSQL = "SELECT Status_ID, Staff_ID, firstlastName FROM staff WHERE > Status_ID=1 Or Status_ID=19 ORDER by firstlastname" > oRs.Open strSQL, conn > > Do while not oRs.EOF > if Request.Form("courses") = oRs("firstlastName") then 'if this is > the selected one then display as selected > Response.Write "<OPTION VALUE = '" & oRS ("staff_ID") & "' > SELECTED>" > Response.Write oRs("firstlastName") & "</Option>" > oRs.MoveNext > else > Response.Write "<OPTION VALUE = '" & oRs ("Staff_ID") & "'>" > Response.Write oRs("firstlastName") & "</Option>" > oRs.MoveNext > end if > loop > The script works fine, it lists the firstlastname field from the > access 2k database and places the corrasponding staff_ID value in > Request.Form("courses"). What I would like to do is display the > selected firstlastname value in box further down the page. > I would appreciate it if anybody could help with, what looks like, a > simple task. Before being able t answer that we need to know why on selected an entry in the combo you submit the form? -- Anthony Jones - MVP ASP/ASP.NET |
|
#3
| |||
| |||
| On Aug 8, 10:23*am, "Anthony Jones" <A...@yadayadayada.com> wrote: > "paulmitchell507" <paulmitchell...@googlemail.com> wrote in message > > news:dfb4f1cf-382a-4362-bd71-95364994694e@z66g2000hsc.googlegroups.com... > > > > > > > I am not sure if this should be posted in a Java forum, bit it does > > concern asp. > > I have the following script on my asp (classic) page. > > > <html> > > <head> > > <title>Example combo box</title> > > > <script language="javascript"> > > <!-- > > > function dept_onchange(frmSelect) { > > frmSelect.submit(); > > } > > > //--> > > </script> > > </head> > > <body> > > <form name="frmSelect" method="Post" action="select.asp"> > > <SELECT name=courses LANGUAGE=javascript onchange="return > > dept_onchange(frmSelect)"> > > <% > > Set oRs=Server.CreateObject("adodb.recordset") > > strSQL = "SELECT Status_ID, Staff_ID, firstlastName FROM staff WHERE > > Status_ID=1 Or Status_ID=19 ORDER by firstlastname" > > oRs.Open strSQL, conn > > > Do while not oRs.EOF > > if Request.Form("courses") = oRs("firstlastName") then 'if this is > > the selected one then display as selected > > Response.Write "<OPTION VALUE = '" & oRS ("staff_ID") & "' > > SELECTED>" > > Response.Write oRs("firstlastName") & "</Option>" > > oRs.MoveNext > > else > > Response.Write "<OPTION VALUE = '" & oRs ("Staff_ID") & "'>" > > Response.Write oRs("firstlastName") & "</Option>" > > oRs.MoveNext > > end if > > loop > > The script works fine, it lists the firstlastname field from the > > access 2k database and places the corrasponding staff_ID value in > > Request.Form("courses"). *What I would like to do is display the > > selected firstlastname value in box further down the page. > > I would appreciate it if anybody could help with, what looks like, a > > simple task. > > Before being able t answer that we need to know why on selected an entry in > the combo you submit the form? > > -- > Anthony Jones - MVP ASP/ASP.NET- Hide quoted text - > > - Show quoted text - I am not sure I fully understand the question (I am what you call a newbie). Please find attched the rest of the code on my asp page. </SELECT> </form> <html> <head> <title>Form to Database</title> </head> <body> <!-- comment - start the HTML form and use a HTML table for formatting--> <form name="form1" action="add_to_database.asp" method="post"> <div align="center"> <table width="80%" border="0"> <tr> <td>group_id :</td> <td><input type="text" name="Name" value=""></td> </tr> <tr> <td>StartDate :</td> <td><input type="text" name="StartDate"></td> </tr> <tr> <td>EndDate :</td> <td><input type="text" name="EndDate"></td> </tr> <tr> <td>If requesting a half day, will you be absent A.M. or P.M.?</td> <td>NA<input type="radio" name="ampm" value=""/> AM<input type="radio" name="ampm" value="AM"/>PM<input type="radio" name="ampm" value="PM"></td> </tr> <tr> <td>Number of Working days :</td> <td><input type="number" name="Numberofdays"></td> </tr> <tr> <td><input type="HIDDEN" name="courses" value="< %=request.form("courses")%>"></td> </tr> <tr> <td> </td> <td><input type="submit" value="submit details" name="submit"></td> </tr> </table> </div> </form> <!-- end the HTML form--> </body> </html> |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.