For Programmers: Free Programming Magazines  


Home > Archive > ASP > July 2004 > submitting two forms in same page?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author submitting two forms in same page?
Bjorn

2004-07-28, 3:55 pm

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


Brian Staff

2004-07-28, 8:55 pm

> 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?


Well, it should work - post more details here.

Brian

Jeff

2004-07-28, 8:55 pm

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" <nomail@rt.sw> wrote in message
news:uya0SANdEHA.1040@TK2MSFTNGP10.phx.gbl...
> 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

2004-07-28, 8:55 pm

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" <gig_bam_takemeout_@verizon.net> wrote in message
news:uVSDt0NdEHA.996@TK2MSFTNGP12.phx.gbl...
> 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" <nomail@rt.sw> wrote in message
> news:uya0SANdEHA.1040@TK2MSFTNGP10.phx.gbl...
>
>



Brian Staff

2004-07-28, 8:55 pm

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

2004-07-29, 3:55 pm

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
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com