473,226 Members | 1,697 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,226 software developers and data experts.

Two forms in asp page

Hi.

If I have two forms in the same asp page:
<form name='firstForm' action='myPage.asp'>

</form>

<form name='secondForm' action='myPage.asp'>

</form>

When using request.form, how can I get values from a specific form?

Regards,
Chris Leffer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
10 3368
Depends on which form you submitted.

ie you can only submit one form

--
Roji. P. Thomas
SQL Server Programmer
"Chris Leffer" <ch****@wank.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
Hi.

If I have two forms in the same asp page:
<form name='firstForm' action='myPage.asp'>

</form>

<form name='secondForm' action='myPage.asp'>

</form>

When using request.form, how can I get values from a specific form?

Regards,
Chris Leffer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2
Don't give the fields the same "name" in both forms........?

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Chris Leffer <ch****@wank.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
Hi.

If I have two forms in the same asp page:
<form name='firstForm' action='myPage.asp'>

</form>

<form name='secondForm' action='myPage.asp'>

</form>

When using request.form, how can I get values from a specific form?

Regards,
Chris Leffer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #3
Chris,

Try the following using Javascript, although you will require two submit
links,
one for each form. Ideally, you should try to stick to one form per page.

*************** ASP page with Forms ******************************

<form method="post" name="firstForm">

</form>

<a href="javascript: document.firstForm.submit();"
onmouseover="document.firstForm.action='/myPage.asp?PAGE_ID=FIRSTFORM';">Sub
mit First Form</a>

<form method="post" name="secondForm">

</form>

<a href="javascript: document.secondForm.submit();"
onmouseover="document.secondForm.action='/myPage.asp?PAGE_ID=SECONDFORM';">S
ubmit Second Form</a>

************************************************** ****************

On the myPage.asp you will need to identify which form has been
submitted, I've done this with a querystring, so you'll need to get the
value of the querystring then use that to determine which request.form
actions to do. so.....

****************** myPage.asp ************************************

<%

PAGE_ID=Request.Querystring("PAGE_ID")

If PAGE_ID=FIRSTFORM Then

Request.Form("blah1")
Request.Form("blah2")
Request.Form("blah3")

End If

If PAGE_ID=SECONDFORM Then

Request.Form("blah4")
Request.Form("blah5")
Request.Form("blah6")

End If

%>

************************************************** ****************

Hope this helps, Dominic

"Chris Leffer" <ch****@wank.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
Hi.

If I have two forms in the same asp page:
<form name='firstForm' action='myPage.asp'>

</form>

<form name='secondForm' action='myPage.asp'>

</form>

When using request.form, how can I get values from a specific form?

Regards,
Chris Leffer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4
Dominic,

Why do something that complicated when you all you would have to do to
accomplish the same result, with no javascript, is to put in a hidden
field in each form with the form name?

Keep it simple!

Jeremy

On Wed, 24 Mar 2004 15:19:26 -0000, "Dominic Marsat"
<djmarsatAThotmail.com> wrote:
Chris,

Try the following using Javascript, although you will require two submit
links,
one for each form. Ideally, you should try to stick to one form per page.

*************** ASP page with Forms ******************************

<form method="post" name="firstForm">

</form>

<a href="javascript: document.firstForm.submit();"
onmouseover="document.firstForm.action='/myPage.asp?PAGE_ID=FIRSTFORM';">Sub
mit First Form</a>

<form method="post" name="secondForm">

</form>

<a href="javascript: document.secondForm.submit();"
onmouseover="document.secondForm.action='/myPage.asp?PAGE_ID=SECONDFORM';">S
ubmit Second Form</a>

************************************************* *****************

On the myPage.asp you will need to identify which form has been
submitted, I've done this with a querystring, so you'll need to get the
value of the querystring then use that to determine which request.form
actions to do. so.....

****************** myPage.asp ************************************

<%

PAGE_ID=Request.Querystring("PAGE_ID")

If PAGE_ID=FIRSTFORM Then

Request.Form("blah1")
Request.Form("blah2")
Request.Form("blah3")

End If

If PAGE_ID=SECONDFORM Then

Request.Form("blah4")
Request.Form("blah5")
Request.Form("blah6")

End If

%>

************************************************* *****************

Hope this helps, Dominic

"Chris Leffer" <ch****@wank.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
Hi.

If I have two forms in the same asp page:
<form name='firstForm' action='myPage.asp'>

</form>

<form name='secondForm' action='myPage.asp'>

</form>

When using request.form, how can I get values from a specific form?

Regards,
Chris Leffer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Jul 19 '05 #5
Thats making it way more complicated than it needs to be.

The easiest is having it all in one "form" and using a querystring to pass
the action that tells your processing script, which form is being submitted,
then using an "If Then" or Select Case, to do the rest.

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Dominic Marsat <djmarsatAThotmail.com> wrote in message
news:uw*************@TK2MSFTNGP09.phx.gbl...
Chris,

Try the following using Javascript, although you will require two submit
links,
one for each form. Ideally, you should try to stick to one form per page.

*************** ASP page with Forms ******************************

<form method="post" name="firstForm">

</form>

<a href="javascript: document.firstForm.submit();"
onmouseover="document.firstForm.action='/myPage.asp?PAGE_ID=FIRSTFORM';">Sub mit First Form</a>

<form method="post" name="secondForm">

</form>

<a href="javascript: document.secondForm.submit();"
onmouseover="document.secondForm.action='/myPage.asp?PAGE_ID=SECONDFORM';">S ubmit Second Form</a>

************************************************** ****************

On the myPage.asp you will need to identify which form has been
submitted, I've done this with a querystring, so you'll need to get the
value of the querystring then use that to determine which request.form
actions to do. so.....

****************** myPage.asp ************************************

<%

PAGE_ID=Request.Querystring("PAGE_ID")

If PAGE_ID=FIRSTFORM Then

Request.Form("blah1")
Request.Form("blah2")
Request.Form("blah3")

End If

If PAGE_ID=SECONDFORM Then

Request.Form("blah4")
Request.Form("blah5")
Request.Form("blah6")

End If

%>

************************************************** ****************

Hope this helps, Dominic

"Chris Leffer" <ch****@wank.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
Hi.

If I have two forms in the same asp page:
<form name='firstForm' action='myPage.asp'>

</form>

<form name='secondForm' action='myPage.asp'>

</form>

When using request.form, how can I get values from a specific form?

Regards,
Chris Leffer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 19 '05 #6
I love the "Keep in Simple" idea!! It is my own mantra. However it can be
done with just a very small piece of JavaScript (even less than is shown in
these post), so it can be very simple with even the JavaScript.
--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
"Jeremy Markman" <jm******@REMOVETHISmentorcom.com> wrote in message
news:40****************@news.microsoft.com...
Dominic,

Why do something that complicated when you all you would have to do to
accomplish the same result, with no javascript, is to put in a hidden
field in each form with the form name?

Keep it simple!

Jeremy

On Wed, 24 Mar 2004 15:19:26 -0000, "Dominic Marsat"
<djmarsatAThotmail.com> wrote:
Chris,

Try the following using Javascript, although you will require two submit
links,
one for each form. Ideally, you should try to stick to one form per page.

*************** ASP page with Forms ******************************

<form method="post" name="firstForm">

</form>

<a href="javascript: document.firstForm.submit();"


onmouseover="document.firstForm.action='/myPage.asp?PAGE_ID=FIRSTFORM';">Su

b
mit First Form</a>

<form method="post" name="secondForm">

</form>

<a href="javascript: document.secondForm.submit();"


onmouseover="document.secondForm.action='/myPage.asp?PAGE_ID=SECONDFORM';">

S
ubmit Second Form</a>

************************************************* *****************

On the myPage.asp you will need to identify which form has been
submitted, I've done this with a querystring, so you'll need to get the
value of the querystring then use that to determine which request.form
actions to do. so.....

****************** myPage.asp ************************************

<%

PAGE_ID=Request.Querystring("PAGE_ID")

If PAGE_ID=FIRSTFORM Then

Request.Form("blah1")
Request.Form("blah2")
Request.Form("blah3")

End If

If PAGE_ID=SECONDFORM Then

Request.Form("blah4")
Request.Form("blah5")
Request.Form("blah6")

End If

%>

************************************************* *****************

Hope this helps, Dominic

"Chris Leffer" <ch****@wank.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
Hi.

If I have two forms in the same asp page:
<form name='firstForm' action='myPage.asp'>

</form>

<form name='secondForm' action='myPage.asp'>

</form>

When using request.form, how can I get values from a specific form?

Regards,
Chris Leffer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 19 '05 #7

"Jeremy Markman" <jm******@REMOVETHISmentorcom.com> wrote in message
news:40****************@news.microsoft.com...
Dominic,

Why do something that complicated when you all you would have to do to
accomplish the same result, with no javascript, is to put in a hidden
field in each form with the form name?

Keep it simple!

Jeremy


My thoughts exactly,
when I end up with several forms in one ASP page, I tend to provide an
hidden field indicating what action needs to be performed once submitted.
Basically I then have a Select Case statement which checks for the value of
the action to perform submitted in the form, which then calls the
appropriate functions which handles the action.

Jul 19 '05 #8
Aye, a hidden field in each form would be much simpler!

"Jeremy Markman" <jm******@REMOVETHISmentorcom.com> wrote in message
news:40****************@news.microsoft.com...
Dominic,

Why do something that complicated when you all you would have to do to
accomplish the same result, with no javascript, is to put in a hidden
field in each form with the form name?

Keep it simple!

Jeremy

On Wed, 24 Mar 2004 15:19:26 -0000, "Dominic Marsat"
<djmarsatAThotmail.com> wrote:
Chris,

Try the following using Javascript, although you will require two submit
links,
one for each form. Ideally, you should try to stick to one form per page.

*************** ASP page with Forms ******************************

<form method="post" name="firstForm">

</form>

<a href="javascript: document.firstForm.submit();"


onmouseover="document.firstForm.action='/myPage.asp?PAGE_ID=FIRSTFORM';">Su

b
mit First Form</a>

<form method="post" name="secondForm">

</form>

<a href="javascript: document.secondForm.submit();"


onmouseover="document.secondForm.action='/myPage.asp?PAGE_ID=SECONDFORM';">

S
ubmit Second Form</a>

************************************************* *****************

On the myPage.asp you will need to identify which form has been
submitted, I've done this with a querystring, so you'll need to get the
value of the querystring then use that to determine which request.form
actions to do. so.....

****************** myPage.asp ************************************

<%

PAGE_ID=Request.Querystring("PAGE_ID")

If PAGE_ID=FIRSTFORM Then

Request.Form("blah1")
Request.Form("blah2")
Request.Form("blah3")

End If

If PAGE_ID=SECONDFORM Then

Request.Form("blah4")
Request.Form("blah5")
Request.Form("blah6")

End If

%>

************************************************* *****************

Hope this helps, Dominic

"Chris Leffer" <ch****@wank.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
Hi.

If I have two forms in the same asp page:
<form name='firstForm' action='myPage.asp'>

</form>

<form name='secondForm' action='myPage.asp'>

</form>

When using request.form, how can I get values from a specific form?

Regards,
Chris Leffer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 19 '05 #9
<form method="post" action="somepage.asp">
<input name="x">
<input type="submit">
<input type="hidden" name="formID" value="1">
</form>

<form method="post" action="somepage.asp">
<input name="x">
<input type="submit">
<input type="hidden" name="formID" value="2">
</form>
somepage.asp:
<%
Response.Write "You submitted form " & Request.Form("formID")
%>

Ray at work

"dan tucker" <an*******@discussions.microsoft.com> wrote in message
news:B2**********************************@microsof t.com...
could someone give a brief example of how to use a hidden value to determine which form is being submitted?
Thnks,

Ol dan

Jul 19 '05 #10
=?Utf-8?B?ZGFuIHR1Y2tlcg==?= wrote on 25 mrt 2004 in
microsoft.public.inetserver.asp.general:
could someone give a brief example of how to use a hidden value to
determine which form is being submitted?


<form id=formA>
<input type=hidden name=whichForm value="formAselected">
<input type=submit value=A>
</form>

<form id=formB>
<input type=hidden name=whichForm value="formBselected">
<input type=submit value=B>
</form>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #11

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

Similar topics

6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
11
by: ElmoWatson | last post by:
I tried on the Security newgroup, as well as other places, and haven't gotten an answer yet - - I'm pulling my hair out over this one. I'm trying to get Forms Authentication working.....I can get...
3
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
5
by: Gavin Stevens | last post by:
I'm trying to figure out the ASP.NET Forms Auth I have 3 or 4 pages i want to allow anonymous access to.. Then I have 5 or 6 pages I placed in another directory in the webproject. These I want...
4
by: 23s | last post by:
I had this problem in the past, after a server reformat it went away, and now after another server reformat it's back again - no clue what's doing it. Here's the flow: Website root is public, no...
6
by: Manny Chohan | last post by:
I am using forms authetication in the web config. i can validate a user against a database and click on images which makes hidden panels visible.However when i click on the link inside a panel...
5
by: ~~~ .NET Ed ~~~ | last post by:
Hi, As you all know when an ASP.NET web form is created that will include web controls and such, it contains a FORM that that identifies the web form and its containing controls. Well, I have a...
7
by: Alan Silver | last post by:
Hello, Sorry this is a bit wordy, but it's a pretty simple question... I have a web site, http://domain/ which is a public site, part of which (http://domain/a/) is protected by forms...
5
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.