Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, If I have an ASP script that

Status
Not open for further replies.

butterfm

Programmer
Feb 15, 2002
132
GB
Hi,

I have an ASP script that contains 2 forms because I want 2 submit buttons on my page.
e.g.

<form name=search ...>

<form name=login ... >

How do I use Request.Form in this instance. i.e. How would it know which form I am wanting data from.

Am I misunderstanding how this works - I've only been using asp a couple of days.

M
 
If a form is seperated as you ahve taken that way of doing things it will only submit to HTTP what input fields are contained within it. If you want to run one script (page) on both forms what I would suggest is two seperate functions in that script with a opener as
If Request.Form(&quot;loginfield&quot;) = &quot;&quot; Then
run the search function
Else
run the login function
End If

If you go with the other way I suggested this would in effect still work out.

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-3811

onpnt2.gif
 
Thanks onpnt,

That is exactly what I want.
Javascript is next on my list of things to learn but I'm trying to avoid it for the time being because I'm just getting to grips with HTML and ASP.

M.

 
another option is a hidden form element with a distinguishing value in it named the same for both forms

like :
<input type=&quot;hidden&quot; name=&quot;formtype&quot; value=&quot;search&quot;>

and

<input type=&quot;hidden&quot; name=&quot;formtype&quot; value=&quot;login&quot;>

 
Thanks.

Do hidden form elemnts still take up space on the page.

M.
 
You can't see hidden form elements on a page, they run silently in the background, but can be accessed with client side scripting (javascript and vbscript) and they are posted to the receiving page just like other &quot;normal&quot; form elements.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top