submitting two forms in same page?

Discussion in 'ASP General' started by Bjorn, Jul 28, 2004.

  1. Bjorn

    Bjorn Guest

    Hi,

    I need to submit in the same page two forms to two different ASP-pages.
    I created two forms, each with hidden input and a submit button. But it
    doesn't work. Nothing happens with the second form.
    Does it exist a way to do that?

    Thanks
    bjorn
     
    Bjorn, Jul 28, 2004
    #1
    1. Advertising

  2. Bjorn

    Jeff Guest

    just out of curiousity... why go to two different asp pages?? can't you use
    the form data to do two different things on the same page of scripts??
    Jeff


    "Bjorn" <> wrote in message
    news:...
    > Hi,
    >
    > I need to submit in the same page two forms to two different ASP-pages.
    > I created two forms, each with hidden input and a submit button. But it
    > doesn't work. Nothing happens with the second form.
    > Does it exist a way to do that?
    >
    > Thanks
    > bjorn
    >
    >
     
    Jeff, Jul 28, 2004
    #2
    1. Advertising

  3. Bjorn

    Bjorn Guest

    Thanks for replying.
    I made an application where the user has to choose several values from a
    list but each on a next stage. In the first page, the user has to chooe a
    dayin a Select, that information is sent to the next page (with a form); in
    the second page, the user must choose a hour (which is dependantly of the
    day chosen), that information and the day are sent to the next page; there,
    the user must choose a computernumber. The final reservation occurs in a 4th
    page (with a form like always).

    And now my problem: the user must be able to go back to the second stage in
    the case he wants to change his choice of hours. So i also did it with
    another form in order to pass the already chosen day, because otherwise, the
    user will change the hour, going then to the 3th stage (the computer choice)
    but without day.
    But nothing happens when i click on the second submit button (step2). Look
    the code:


    <form id=ins method="post">
    <input id=ruur type="hidden" value="" >
    <input id=rdag type="hidden" value="" >
    <input id=rpc type="hidden" value="" >
    <INPUT id=smt TYPE="submit" value="reservation" >
    </form>

    <form id=ins2 method="post">
    <input id=rdag2 type="hidden" value="" >
    <input id=rpc2 type="hidden" value="" >
    <INPUT id=step2 TYPE="submit" value="go back to the hours" >
    </form>
    ......
    <script type="text/javascript">
    function resonclick()
    {
    pc=document.getElementById("pcnr").value //chosen computer in the
    list
    document.getElementById("ruur").value=hr //chosen hour into hidden
    field
    document.getElementById("rdag").value=dat //chosen day into hidden
    field
    document.getElementById("rpc").value=pc // chosen computer into
    hidden field
    document.getElementById("ins").action="insert.asp" //reservation occurs
    here: this works
    document.getElementById("ins").submit
    return true;
    }

    function step2onclick()
    {
    document.getElementById("rdag2").value=dat // to send the chosen
    day to the hour-page
    document.getElementById("ins2").action="stage2.asp"
    document.getElementById("ins2").submit
    return true;
    }

    document.getElementById("pcnr").onclick = resonclick //pcnr=list
    of computer in a select
    document.getElementById("step2").onclick = step2onclick //nothing
    happens, no errors

    </script>

    The "stage2.asp code":
    <%
    dat=request.form("rdag2")
    ....







    "Jeff" <> wrote in message
    news:...
    > just out of curiousity... why go to two different asp pages?? can't you

    use
    > the form data to do two different things on the same page of scripts??
    > Jeff
    >
    >
    > "Bjorn" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > I need to submit in the same page two forms to two different ASP-pages.
    > > I created two forms, each with hidden input and a submit button. But it
    > > doesn't work. Nothing happens with the second form.
    > > Does it exist a way to do that?
    > >
    > > Thanks
    > > bjorn
    > >
    > >

    >
    >
     
    Bjorn, Jul 28, 2004
    #3
  4. Bjorn

    Bjorn Guest

    thanks

    "Brian Staff" <brianstaff@[NoSpam]compuserve.com> wrote in message
    news:VA.0000028d.8c2b143e@bstaffw2k...
    > Bjorn,
    >
    > Your code was incomplete... and you appeared to be referencing

    non-existant
    > controls. Anyway, this should get you going...
    >
    > <form id=ins method="post">
    > <input id=ruur type="hidden" value="" >
    > <input id=rdag type="hidden" value="" >
    > <input id=rpc type="hidden" value="" >
    > <INPUT id=smt TYPE="submit" value="reservation" >
    > </form>
    > <form id=ins2 method="post">
    > <input id=rdag2 type="hidden" value="" >
    > <input id=rpc2 type="hidden" value="" >
    > <INPUT id=step2 TYPE="submit" value="go back to the hours" >
    > </form>
    > </body>
    > <script type="text/javascript">
    > function resonclick()
    > {
    > //pc=document.getElementById("pcnr").value //chosen computer in the

    list
    > document.getElementById("ruur").value="hr" //chosen hour into

    hidden
    > field
    > document.getElementById("rdag").value="dat" //chosen day into

    hidden
    > field
    > document.getElementById("rpc").value="pc" // chosen computer

    into
    > hidden field
    > document.getElementById("ins").action="insert.asp" //reservation occurs
    > here: this works
    > document.getElementById("ins").submit
    > return true;
    > }
    >
    > function step2onclick()
    > {
    > document.getElementById("rdag2").value="dat" // to send the

    chosen
    > day to the hour-page
    > document.getElementById("ins2").action="stage2.asp"
    > document.getElementById("ins2").submit
    > return true;
    > }
    >
    > document.getElementById("smt").onclick = resonclick //pcnr=list

    of
    > computer in a select
    > document.getElementById("step2").onclick = step2onclick //nothing
    > happens, no errors
    >
    > </script>
    >
    > Brian
    >
     
    Bjorn, Jul 29, 2004
    #4
    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. Sara T.
    Replies:
    0
    Views:
    624
    Sara T.
    Mar 2, 2005
  2. Steven Reid

    Submitting forms second time just resets page

    Steven Reid, Dec 29, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    7
    Views:
    207
    Steve Kirchner
    Feb 2, 2005
  3. Sara T.
    Replies:
    0
    Views:
    141
    Sara T.
    Mar 2, 2005
  4. Nospam
    Replies:
    1
    Views:
    136
    Ben Morrow
    Feb 3, 2008
  5. paratge

    Submitting two forms in one click

    paratge, Apr 16, 2007, in forum: Javascript
    Replies:
    4
    Views:
    144
    paratge
    Apr 16, 2007
Loading...

Share This Page