basic asp question

A

Andrew Cheng

Hi all,
Can I submit more than one form on the same page? If yes, how do I
reference the request field on different form? I tried the following
and not working. Is there any sample code out there? Thanks.

request.form("form_a")("Name")


request.form("form_b")("Status")

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

Ray at

No, you cannot. Is there any reason that you cannot have all the fields in
one <form></form> though?

Ray at home
 
K

Ken Schaefer

You can't submit more than one form.

Also, on the server-side, the server has no concept of the layout of your
page (or the number of forms on it). All it sees is the data submitted by
the browser. So, if the first form contained an element called "firstname",
and the second form contained an alement called "status" then you'd still
do:

Request.Form("name")
Request.Form("status")

It's just that one of those two would be blank.

Now, your options are:
a) put everything into one big form
-or-
b) when you submit either form, use some client-side javascript to copy all
the values in the other form into hidden form elements in the form being
submitted. Obviously this relies on the client supporting/allowing
javascript.

Cheers
Ken


:
: Hi all,
: Can I submit more than one form on the same page? If yes, how do I
: reference the request field on different form? I tried the following
: and not working. Is there any sample code out there? Thanks.
:
: request.form("form_a")("Name")
:
:
: request.form("form_b")("Status")
:
: *** Sent via Devdex http://www.devdex.com ***
: Don't just participate in USENET...get rewarded for it!
 
E

Evertjan.

Ken Schaefer wrote on 08 jun 2004 in
microsoft.public.inetserver.asp.general:
Now, your options are:
a) put everything into one big form
-or-
b) when you submit either form, use some client-side javascript to
copy all the values in the other form into hidden form elements in the
form being submitted. Obviously this relies on the client
supporting/allowing javascript.

Just give the input elements different names:

<form id="formone" method="post">
<input name="form1-street">
<input name="form1-town">
</form>
<form id="formtwo" method="post">
<input name="form2-street">
<input name="form2-town">
</form>

Look daddy, no clientside javascript!

serverside vbs or js:

form1-street = Request.form("form1-street")
form1-town = Request.form("form1-town")
form2-street = Request.form("form2-street")
form2-town = Request.form("form2-town")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,829
Latest member
KimberAlli

Latest Threads

Top