473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Easy question - Trouble with Request.Form

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

Apr 4 '07 #1
8 1705
"Rabel" <Ra***@Creativeness.comwrote in message
news:11*********************@w1g2000hsg.googlegrou ps.com...
>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"))
%>


Apr 4 '07 #2
"Marc" <so******@dirtymail.comwrote in message
news:eT**************@TK2MSFTNGP03.phx.gbl...
"Rabel" <Ra***@Creativeness.comwrote in message
news:11*********************@w1g2000hsg.googlegrou ps.com...
>>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!
Apr 4 '07 #3
On Apr 4, 1:08 pm, "Marc" <sorry...@dirtymail.comwrote:
"Marc" <sorry...@dirtymail.comwrote in message

news:eT**************@TK2MSFTNGP03.phx.gbl...
"Rabel" <R...@Creativeness.comwrote in message
news:11*********************@w1g2000hsg.googlegrou ps.com...
>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!- 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

Apr 4 '07 #4
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" <Ra***@Creativeness.comwrote in message news:11*********************@w1g2000hsg.googlegrou ps.com...
>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

Apr 4 '07 #5
On Apr 4, 3:02 pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
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:11*********************@w1g2000hsg.goo glegroups.com...
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- 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.

Apr 4 '07 #6
"Rabel" <Ra***@Creativeness.comwrote:
>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)
Sl********@bls.gov
http://members.cox.net/slatteryt
Apr 4 '07 #7
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" <Ra***@Creativeness.comwrote in message news:11**********************@n59g2000hsh.googlegr oups.com...
On Apr 4, 3:02 pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
>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:11*********************@w1g2000hsg.goo glegroups.com...
>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- 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.

Apr 4 '07 #8
"Rabel" <Ra***@Creativeness.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
On Apr 4, 1:08 pm, "Marc" <sorry...@dirtymail.comwrote:
"Marc" <sorry...@dirtymail.comwrote in message

news:eT**************@TK2MSFTNGP03.phx.gbl...
"Rabel" <R...@Creativeness.comwrote in message
news:11*********************@w1g2000hsg.googlegrou ps.com...
>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!- 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>

Apr 4 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Russ Perry Jr | last post by:
I'm using "ID" and "Value" in the generic sense here... Let's say one page I had a <html:select> with a collection like this: <html:options collection="items" property="key"...
1
by: Anand | last post by:
Hi i am having trouble adding a recordset into the access database, the code seems to be working fine it passs and parses through all variables just fine without showing any errors and also when i...
2
by: Sean Dotson | last post by:
I have a form that passes variables to an asp file and then uploads a file. For some reason the request.form is not getting the info from the form. It's returning blanks. Any insight would be...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
0
by: scottf35 | last post by:
Hi, I am working on (read that - upgrading) an application. This application creates an HTTPWebRequest object, populates it with values which are then sucked out of the Request.Form object (eg...
2
by: Roshawn | last post by:
Hi, On my asp.net page I have an html form. I've set runat attribute to server and filled it with server controls. All settings are as I like them. So here's the problem: when I perform a...
5
by: Amoril | last post by:
I've read quite a few different message on various boards and for some reason I'm still having trouble wrapping my head around this viewstate maintenance and trying to get these dynamically created...
3
by: ibeehbk | last post by:
Hi. I have a form made in xhtml. I test via vbscript to make sure none of the fields are empty and properly formatted (ie email). All the regular fields work. However, I have two drop down menus...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.