basic asp question

Discussion in 'ASP General' started by Andrew Cheng, Jun 7, 2004.

  1. Andrew Cheng

    Andrew Cheng Guest

    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!
     
    Andrew Cheng, Jun 7, 2004
    #1
    1. Advertising

  2. Andrew Cheng

    Ray at Guest

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

    Ray at home

    "Andrew Cheng" <> wrote in message
    news:...
    >
    > 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.
     
    Ray at, Jun 8, 2004
    #2
    1. Advertising

  3. Andrew Cheng

    Ken Schaefer Guest

    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


    "Andrew Cheng" <> wrote in message
    news:...
    :
    : 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!
     
    Ken Schaefer, Jun 8, 2004
    #3
  4. Andrew Cheng

    Evertjan. Guest

    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")


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jun 8, 2004
    #4
  5. Andrew Cheng

    Andrew Cheng Guest

    Thank you all. I will work around using fields naming convention.


    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Andrew Cheng, Jun 8, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Newbie

    Basic question b/w ASP & ASP .NET

    Newbie, Jul 29, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    1,874
    Steve C. Orr, MCSD
    Jul 30, 2003
  2. Mike Christie

    Very basic ASP.NET question

    Mike Christie, Aug 5, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    401
    MS News
    Aug 5, 2003
  3. Engineer
    Replies:
    6
    Views:
    656
    Jeremy Bowers
    May 1, 2005
  4. Replies:
    0
    Views:
    461
  5. Ark Khasin

    A basic question question about volatile use

    Ark Khasin, Jul 31, 2008, in forum: C Programming
    Replies:
    12
    Views:
    367
    Ark Khasin
    Jul 31, 2008
Loading...

Share This Page