PDA

Click to See Complete Forum and Search --> : Two buttons with different forms


hpl
Dec 6th, 2001, 08:50 AM
The first button I want to make a calculation with and when the other button is clicked I want a new window to pop up. How can this be done?

CiberTHuG
Dec 6th, 2001, 09:56 AM
Uhm... the same way you would do it if there was only one button and one form.

scoutt
Dec 6th, 2001, 11:24 AM
well the first buton would have

onclick="yourfunction()" then on the second button you would have onclick="popup_function()"

but you would have to have these function in javascript in your page.

hpl
Dec 7th, 2001, 01:11 AM
Well if I have a form with an action, how can I get two different output pages? The form has an action which is applied when the submit is clicked, what about the button? I have tried the code below, but nothing happens when I hit the button.
My code is

<form name="form2" method="post" action="fessor.asp">
<TD>
<p align="left">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR><TD COLSPAN="3" BGCOLOR="#000000"><DIV STYLE="COLOR: white; PADDING-BOTTOM: 2px;
PADDING-LEFT: 2px; PADDING-RIGHT: 2px; PADDING-TOP: 2px; TEXT-ALIGN: center"><b>Resultater</DIV></B></TD></B>
</TR>
<TR><TD WIDTH="1" BGCOLOR="#000000"><!-- venstre kant --></TD>
<TD><!-- Miderste kolonne m. indhold -->
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3">
<style>
.AlignClass
{
text-align:center;
}
</style>
<tr>
<td>Kappediameter</td>
<td><INPUT type="text" id=text4 name=text4 size=4 class="AlignClass" value = <%=d_kappe%> readonly>&nbsp;m</td>
</tr>
<tr>
<td>Varmeovergangskoeff.</td>
<td><INPUT type="text" id=text1 name=text1 readonly size=4 class="AlignClass" value=<%=round(u,2)%>>&nbsp;W/m<sup>2</sup>K</td>
<tr>
<tr>
<td>Varmetab</td>
<td><INPUT type="text" id=text1 name=text1 readonly size=4 class="AlignClass" value=<%=round(tab1,1)%>>&nbsp;W/m</td>
<tr>
<tr>
<td>Totalt varmetab</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(vtab,0)%>>&nbsp;W</td>
</tr>
<tr>
<td>Temperatur v. <%=length%> m</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(t_end,1)%>>&nbsp;°C</td>
</tr>
<tr>
<td>Afkølingstid</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(tid,1)%>>&nbsp;h</td>
</tr>
</TABLE>
</TD><TD WIDTH="1" BGCOLOR="#000000"><!-- højre kant --></TD></TR>
<TR><TD COLSPAN="3" HEIGHT="2" BGCOLOR="#000000"><!-- underkant --></TD>
</TR>
<tr>
<td></td>
<td><INPUT type="button" value="Button" id=button1 name=button1 onclick="print.asp" target="_blank">&nbsp;</td>
</tr>
</TABLE>
<input type=submit name="Submit1" value="Se graf">

scoutt
Dec 7th, 2001, 09:59 AM
that is because your

onclick="print.asp"

has to be a function of javascript.

onclick="print()"

then in that print() function you load the print.asp page.
or you can have 2 different forms


<form name="form2" method="post" action="fessor.asp">
<TD>
<p align="left">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR><TD COLSPAN="3" BGCOLOR="#000000"><DIV STYLE="COLOR: white; PADDING-BOTTOM: 2px;
PADDING-LEFT: 2px; PADDING-RIGHT: 2px; PADDING-TOP: 2px; TEXT-ALIGN: center"><b>Resultater</DIV></B></TD></B>
</TR>
<TR><TD WIDTH="1" BGCOLOR="#000000"><!-- venstre kant --></TD>
<TD><!-- Miderste kolonne m. indhold -->
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3">
<style>
.AlignClass
{
text-align:center;
}
</style>
<tr>
<td>Kappediameter</td>
<td><INPUT type="text" id=text4 name=text4 size=4 class="AlignClass" value = <%=d_kappe%> readonly> m</td>
</tr>
<tr>
<td>Varmeovergangskoeff.</td>
<td><INPUT type="text" id=text1 name=text1 readonly size=4 class="AlignClass" value=<%=round(u,2)%>> W/m<sup>2</sup>K</td>
<tr>
<tr>
<td>Varmetab</td>
<td><INPUT type="text" id=text1 name=text1 readonly size=4 class="AlignClass" value=<%=round(tab1,1)%>> W/m</td>
<tr>
<tr>
<td>Totalt varmetab</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(vtab,0)%>> W</td>
</tr>
<tr>
<td>Temperatur v. <%=length%> m</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(t_end,1)%>> °C</td>
</tr>
<tr>
<td>Afkølingstid</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(tid,1)%>> h</td>
</tr>
</TABLE>
</TD><TD WIDTH="1" BGCOLOR="#000000"><!-- højre kant --></TD></TR>
<TR><TD COLSPAN="3" HEIGHT="2" BGCOLOR="#000000"><!-- underkant --></TD>
</TR>
<tr>
<td><input type=submit name="Submit1" value="Se graf"></td></form>
<td>
<form action="print.asp" method=post name=form3>
<INPUT type="button" value="Button" id=button1 name=button1> </form></td>
</tr>
</TABLE>

hpl
Dec 10th, 2001, 01:29 AM
OK, could you please tell me how to load an ASP-page in a JavaScript function, then I don't need a set of forms.

scoutt
Dec 10th, 2001, 07:56 AM
just use what I showed you. it has to forms, the easiest way to do it.

hpl
Dec 12th, 2001, 02:07 AM
well, the problem is that nothing happens when I hit the button. Are you sure it's the same code when you use button instead of submit?

scoutt
Dec 12th, 2001, 08:00 AM
if you are going to use 2 forms, yes you will need to change the button to a submit, sorry forgot about that one.

daveejay
Dec 13th, 2001, 08:01 AM
You don't need to use two forms (and I'm thinking if you do, there won't be any data posted from that second empty form - not sure about that tho')
Try stg like this:

<input type=submit value="Ammend Order Details" onClick="document.frmhidden.action='Products.asp?ammend=true';" name=ammendorder>

The other button can be just a normal submit, that will execute the form's action attribute.

Hope this helps.

DJ