Results 1 to 10 of 10

Thread: Two buttons with different forms

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Question Two buttons with different forms

    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?

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Uhm... the same way you would do it if there was only one button and one form.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  3. #3
    scoutt
    Guest
    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.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    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
    Code:
    <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">

  5. #5
    scoutt
    Guest
    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

    Code:
    <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>

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    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.

  7. #7
    scoutt
    Guest
    just use what I showed you. it has to forms, the easiest way to do it.

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    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?

  9. #9
    scoutt
    Guest
    if you are going to use 2 forms, yes you will need to change the button to a submit, sorry forgot about that one.

  10. #10
    Member
    Join Date
    Feb 2000
    Location
    Kettering, Northants, England
    Posts
    56
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width