Connecting Tech Pros Worldwide Help | Site Map

Easy question - Trouble with Request.Form

Rabel
Guest
 
Posts: n/a
#1: Apr 4 '07
I am new to asp and I am having a little trouble with the Request.form
option. What I want to do is I have a dropdown box.

<select name="selecter" class="text" id="selecter">
<option value="page1.htm" selected>Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>

and I want to use a button that then will take you to the page you
selected so I have been trying codes like this.

<a href="<%= Request.Form("selecter") %>" ><img src="submit.jpg"
width="45" height="18" border="0"></a>

Any idea what I am doing wrong, any help is apprieciated.

Thanks,
Randy

Marc
Guest
 
Posts: n/a
#2: Apr 4 '07

re: Easy question - Trouble with Request.Form


"Rabel" <Randy@Creativeness.comwrote in message
news:1175704239.315081.13920@w1g2000hsg.googlegrou ps.com...
Quote:
>I am new to asp and I am having a little trouble with the Request.form
option. What I want to do is I have a dropdown box.
>
<select name="selecter" class="text" id="selecter">
<option value="page1.htm" selected>Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>
>
and I want to use a button that then will take you to the page you
selected so I have been trying codes like this.
>
<a href="<%= Request.Form("selecter") %>" ><img src="submit.jpg"
width="45" height="18" border="0"></a>
>
Any idea what I am doing wrong, any help is apprieciated.
>
Thanks,
Randy
I think you want to try javascript for that but...


<%
Response.Redirect(Request.Form("selecter"))
%>






Marc
Guest
 
Posts: n/a
#3: Apr 4 '07

re: Easy question - Trouble with Request.Form


"Marc" <sorrygot@dirtymail.comwrote in message
news:eTiFrttdHHA.4468@TK2MSFTNGP03.phx.gbl...
Quote:
"Rabel" <Randy@Creativeness.comwrote in message
news:1175704239.315081.13920@w1g2000hsg.googlegrou ps.com...
Quote:
>>I am new to asp and I am having a little trouble with the Request.form
>option. What I want to do is I have a dropdown box.
>>
><select name="selecter" class="text" id="selecter">
> <option value="page1.htm" selected>Page 1</option>
> <option value="page2.htm">Page 2</option>
> <option value="page3.htm">Page 3</option>
></select>
>>
>and I want to use a button that then will take you to the page you
>selected so I have been trying codes like this.
>>
><a href="<%= Request.Form("selecter") %>" ><img src="submit.jpg"
>width="45" height="18" border="0"></a>
>>
>Any idea what I am doing wrong, any help is apprieciated.
>>
>Thanks,
>Randy
>
I think you want to try javascript for that but...
>
>
<%
Response.Redirect(Request.Form("selecter"))
%>
>
I can't help myself:

<select name="selecter" class="text" id="selecter"
onchange="if(this.selectedIndex>0)document.locatio n.href=this.options[this.selectedIndex].value">
<option value="" selected>Select page</option>
<option value="page1.htm">Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>

Make sure the "onchange" bit until the ">" is on one line!


Rabel
Guest
 
Posts: n/a
#4: Apr 4 '07

re: Easy question - Trouble with Request.Form


On Apr 4, 1:08 pm, "Marc" <sorry...@dirtymail.comwrote:
Quote:
"Marc" <sorry...@dirtymail.comwrote in message
>
news:eTiFrttdHHA.4468@TK2MSFTNGP03.phx.gbl...
>
>
>
Quote:
"Rabel" <R...@Creativeness.comwrote in message
news:1175704239.315081.13920@w1g2000hsg.googlegrou ps.com...
Quote:
>I am new to asp and I am having a little trouble with the Request.form
option. What I want to do is I have a dropdown box.
>
Quote:
Quote:
<select name="selecter" class="text" id="selecter">
<option value="page1.htm" selected>Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>
>
Quote:
Quote:
and I want to use a button that then will take you to the page you
selected so I have been trying codes like this.
>
Quote:
Quote:
<a href="<%= Request.Form("selecter") %>" ><img src="submit.jpg"
width="45" height="18" border="0"></a>
>
Quote:
Quote:
Any idea what I am doing wrong, any help is apprieciated.
>
Quote:
Quote:
Thanks,
Randy
>
Quote:
I think you want to try javascript for that but...
>
Quote:
<%
Response.Redirect(Request.Form("selecter"))
%>
>
I can't help myself:
>
<select name="selecter" class="text" id="selecter"
onchange="if(this.selectedIndex>0)document.locatio n.href=this.options[this.*selectedIndex].value">
<option value="" selected>Select page</option>
<option value="page1.htm">Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>
>
Make sure the "onchange" bit until the ">" is on one line!- Hide quoted text -
>
- Show quoted text -
Thanks Marc - but is there a way that I can still use a button then
just when you select from the box.

Thanks

Jon Paal [MSMD]
Guest
 
Posts: n/a
#5: Apr 4 '07

re: Easy question - Trouble with Request.Form


You need to have a default value for your link until the user makes a selection

and

-- you either need an autopostabck on your selector which will then change the link value

or

-- you need to use javascript to change the link value based upon the user selection.







"Rabel" <Randy@Creativeness.comwrote in message news:1175704239.315081.13920@w1g2000hsg.googlegrou ps.com...
Quote:
>I am new to asp and I am having a little trouble with the Request.form
option. What I want to do is I have a dropdown box.
>
<select name="selecter" class="text" id="selecter">
<option value="page1.htm" selected>Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>
>
and I want to use a button that then will take you to the page you
selected so I have been trying codes like this.
>
<a href="<%= Request.Form("selecter") %>" ><img src="submit.jpg"
width="45" height="18" border="0"></a>
>
Any idea what I am doing wrong, any help is apprieciated.
>
Thanks,
Randy
>

Rabel
Guest
 
Posts: n/a
#6: Apr 4 '07

re: Easy question - Trouble with Request.Form


On Apr 4, 3:02 pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
Quote:
You need to have a default value for your link until the user makes a selection
>
and
>
-- you either need an autopostabck on your selector which will then change the link value
>
or
>
-- you need to use javascript to change the link value based upon the user selection.
>
>
>
"Rabel" <R...@Creativeness.comwrote in messagenews:1175704239.315081.13920@w1g2000hsg.goo glegroups.com...
Quote:
I am new to asp and I am having a little trouble with the Request.form
option. What I want to do is I have a dropdown box.
>
Quote:
<select name="selecter" class="text" id="selecter">
<option value="page1.htm" selected>Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>
>
Quote:
and I want to use a button that then will take you to the page you
selected so I have been trying codes like this.
>
Quote:
<a href="<%= Request.Form("selecter") %>" ><img src="submit.jpg"
width="45" height="18" border="0"></a>
>
Quote:
Any idea what I am doing wrong, any help is apprieciated.
>
Quote:
Thanks,
Randy- Hide quoted text -
>
- Show quoted text -
Thanks Jon but I dont really understand what you mean - I think that
you are describing Marc's js version which I am using but I would
still like to have a button make it go to the next page, not just when
you select a option in the dropdown box.

Tim Slattery
Guest
 
Posts: n/a
#7: Apr 4 '07

re: Easy question - Trouble with Request.Form


"Rabel" <Randy@Creativeness.comwrote:
Quote:
>I am new to asp and I am having a little trouble with the Request.form
>option. What I want to do is I have a dropdown box.
>
><select name="selecter" class="text" id="selecter">
<option value="page1.htm" selected>Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
></select>
>
>and I want to use a button that then will take you to the page you
>selected so I have been trying codes like this.
>
><a href="<%= Request.Form("selecter") %>" ><img src="submit.jpg"
>width="45" height="18" border="0"></a>
Looks OK at a glance. In order to use Request.Form, your form has to
have been POSTed, you cannot use method="get" if you're going to use
that. If you want that link to be in the same page as the select
group, then you have to rethink what you're doing. ASP is a
server-side platform, and the <%= tag in the <a href= HTML tag won't
work unless the form has been submitted and you're building a new
page.

It can be done in the same page, but it's done using client-side
Javascript (use a handler for the onChange event in the select group).
That being the case, it's off-topic in this group.

--
Tim Slattery
MS MVP(DTS)
Slattery_T@bls.gov
http://members.cox.net/slatteryt
Jon Paal [MSMD]
Guest
 
Posts: n/a
#8: Apr 4 '07

re: Easy question - Trouble with Request.Form


I guess it's not clear what you are trying to accomplish.

if you want the dropdownlist to send the user to another page, then on the post back, use

if len(Request.Form("selecter")) 0 then
Response.Redirect(Request.Form("selecter"))
end if


if you want to populate the clientside anchor to give the user a button, then use javascript to get the selected value from the
dropdownlist through the onchange event.






"Rabel" <Randy@Creativeness.comwrote in message news:1175715124.993807.196670@n59g2000hsh.googlegr oups.com...
Quote:
On Apr 4, 3:02 pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
Quote:
>You need to have a default value for your link until the user makes a selection
>>
> and
>>
>-- you either need an autopostabck on your selector which will then change the link value
>>
> or
>>
>-- you need to use javascript to change the link value based upon the user selection.
>>
>>
>>
>"Rabel" <R...@Creativeness.comwrote in messagenews:1175704239.315081.13920@w1g2000hsg.goo glegroups.com...
Quote:
>I am new to asp and I am having a little trouble with the Request.form
option. What I want to do is I have a dropdown box.
>>
Quote:
<select name="selecter" class="text" id="selecter">
<option value="page1.htm" selected>Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>
>>
Quote:
and I want to use a button that then will take you to the page you
selected so I have been trying codes like this.
>>
Quote:
<a href="<%= Request.Form("selecter") %>" ><img src="submit.jpg"
width="45" height="18" border="0"></a>
>>
Quote:
Any idea what I am doing wrong, any help is apprieciated.
>>
Quote:
Thanks,
Randy- Hide quoted text -
>>
>- Show quoted text -
>
Thanks Jon but I dont really understand what you mean - I think that
you are describing Marc's js version which I am using but I would
still like to have a button make it go to the next page, not just when
you select a option in the dropdown box.
>

Marc
Guest
 
Posts: n/a
#9: Apr 4 '07

re: Easy question - Trouble with Request.Form


"Rabel" <Randy@Creativeness.comwrote in message
news:1175710610.233675.300500@w1g2000hsg.googlegro ups.com...
On Apr 4, 1:08 pm, "Marc" <sorry...@dirtymail.comwrote:
Quote:
"Marc" <sorry...@dirtymail.comwrote in message
>
news:eTiFrttdHHA.4468@TK2MSFTNGP03.phx.gbl...
>
>
>
Quote:
"Rabel" <R...@Creativeness.comwrote in message
news:1175704239.315081.13920@w1g2000hsg.googlegrou ps.com...
Quote:
>I am new to asp and I am having a little trouble with the Request.form
option. What I want to do is I have a dropdown box.
>
Quote:
Quote:
<select name="selecter" class="text" id="selecter">
<option value="page1.htm" selected>Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>
>
Quote:
Quote:
and I want to use a button that then will take you to the page you
selected so I have been trying codes like this.
>
Quote:
Quote:
<a href="<%= Request.Form("selecter") %>" ><img src="submit.jpg"
width="45" height="18" border="0"></a>
>
Quote:
Quote:
Any idea what I am doing wrong, any help is apprieciated.
>
Quote:
Quote:
Thanks,
Randy
>
Quote:
I think you want to try javascript for that but...
>
Quote:
<%
Response.Redirect(Request.Form("selecter"))
%>
>
I can't help myself:
>
<select name="selecter" class="text" id="selecter"
onchange="if(this.selectedIndex>0)document.locatio n.href=this.options[this.*selectedIndex].value">
<option value="" selected>Select page</option>
<option value="page1.htm">Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>
>
Make sure the "onchange" bit until the ">" is on one line!- Hide quoted
text -
>
- Show quoted text -
Thanks Marc - but is there a way that I can still use a button then
just when you select from the box.

Thanks


sure, but remember... this isn't a javascript group.

<form name="frm">
<select name="selecter" class="text" id="selecter">
<option value="page1.htm">Page 1</option>
<option value="page2.htm">Page 2</option>
<option value="page3.htm">Page 3</option>
</select>
<input type="button" value="go there"
onclick="document.location.href=document.frm.selec ter.options[document.frm.selecter.selectedIndex].value"
/>
</form>



Closed Thread