p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   value of the drop-down (http://p2p.wrox.com/showthread.php?t=26023)

crmpicco February 24th, 2005 06:15 AM

value of the drop-down
 
<%
set rst1=con.execute("select * from company where company_id = '" & agencyid & "' and agencyid <> '"&agencyid&"'")
%>
<select name="searchby">

<% Do Until rst1.EOF %>
<option value="<%=trim(rst1("agencyid"))%>"><%=trim(rst1(" company_name"))%></option>
<%
rst1.movenext
loop
%>
                 </select>

<input name="timeoption" type="radio" value="option_bookings_only" onClick="location.href='option_agency_bookings.asp '">

how do i take the value of the drop-down menu i select on the page option_agency_bookings.asp




www.crmpicco.co.uk

ChrisScott February 24th, 2005 06:21 AM

Submit the form to the page rather than just changing the location & then get it from the Request object.

HTH,

Chris


crmpicco February 24th, 2005 06:43 AM

         <form name="form2" method="post" action="agency_bookdates.asp">
           <input name="agencyid" type="hidden" value="<%=agencyid%>">
           <tr bordercolor="#EEEEEE" bgcolor="#006699">
             <td colspan="3"><div align="left"><strong>MacKenzie - Agency - Booking Search </strong></div></td>
           </tr>
           <tr bordercolor="#EEEEEE" bgcolor="#EEEEEE">
             <td><div align="right">Search by </div></td>
             <td><div align="left">
<%
'response.write "agencyid = " & agencyid & "<br>"
set rst1=con.execute("select * from company where company_id = '" & agencyid & "' and agencyid <> '"&agencyid&"'")
user = rst1("agencyid")
%>
<select name="searchby">

<% Do Until rst1.EOF %>
<option value="<%=trim(rst1("agencyid"))%>"><%=trim(rst1(" company_name"))%></option>
<%
rst1.movenext
loop
%>
</select>
             </div></td>
             <td>&nbsp;</td>
           </tr>
           <tr bordercolor="#EEEEEE" bgcolor="#EEEEEE">
             <td width="263"><div align="right">Display all bookings that are </div></td>
             <td colspan="2"><div align="left">
                 <input name="timeoption" type="radio" value="current" checked>
             Current (Confirmed)</div></td>
           </tr>
           <tr bordercolor="#EEEEEE" bgcolor="#EEEEEE">
             <td><div align="right"></div></td>
             <td colspan="2"><div align="left">
                 <input name="timeoption" type="radio" value="pastdate">
             Past Date </div></td>
           </tr>
               <tr bordercolor="#EEEEEE" bgcolor="#EEEEEE">
             <td><div align="right"></div></td>
             <td colspan="2"><div align="left">
                 <input name="timeoption" type="radio" value="option_bookings_only" onClick="location.href='option_agency_bookings.asp '">
             Option Bookings </div></td>
           </tr>
<% if badlogin3 = "true" then%>
<tr bordercolor="#EEEEEE" bgcolor="#EEEEEE"><td colspan="3">
<div align="center">

Sorry, No Bookings Available!

</div>
</td></tr>
<%else%>
<tr><td></td></tr>
<%end if%>



           <tr bordercolor="#EEEEEE" bgcolor="#EEEEEE">
             <td>&nbsp;</td>
             <td>&nbsp;</td>
             <td><div align="right">
                 <input name="submit" type="submit" title='Click here to search the whole table by requested criteria' onMouseOver='style.cursor="hand"' value="Submit" width="100" height="25">
             </div></td>
           </tr>
         </form>

Thats the whole form.

as you can see the action is set to go to agency_bookdates.asp on submit. which i need. but if the Option Bookings radio button is clicked i need it to go to option_agency_bookings.asp and take the value of <select name="searchby">

www.crmpicco.co.uk

ChrisScott February 24th, 2005 06:53 AM

Change the action of the form when the option is clicked...
Code:

this.form.action = 'option_agency_bookings.asp'; this.form.submit();
Cheers,

Chris


crmpicco February 24th, 2005 06:55 AM

how do i do this?

www.crmpicco.co.uk

ChrisScott February 24th, 2005 06:58 AM

Just use it on the onclick of the radio button.




crmpicco February 24th, 2005 08:47 AM

Problem (again)

this works:

<input name="timeoption" type="radio" value="option_bookings_only" onClick="this.form.action = 'option_bookings.asp'; this.form.submit();">

but this doesnt:

<input name="timeoption" type="radio" value="option_bookings_only" onClick="this.form.action = 'option_agency_bookings.asp'; this.form.submit();">

Both pages exist, but i get a error:

"Object doesnt support this property or method"

why is this?

picco

www.crmpicco.co.uk

crmpicco February 24th, 2005 10:03 AM

onClick="this.form.action='option_agency_bookings. asp';this.form.submit();"

does 'form' need to be the name of the form?

as form2 doesnt work either.....

:-(

www.crmpicco.co.uk

ChrisScott February 24th, 2005 10:29 AM

No, it just needs to be form - I think the problem may be that you have a submit button called submit - so the forms submit() method is not getting called correctly. Try changing the name to something else.

HTH,

Chris


crmpicco February 24th, 2005 10:38 AM

<input name="submit_button" type="submit" title='Click here to search the whole table by requested criteria' onMouseOver='style.cursor="hand"' value="Submit" width="100" height="25">

renamed it to submit_button

from submit

cheers

www.crmpicco.co.uk


All times are GMT -4. The time now is 05:53 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.