01-09-2004, 07:18 PM
how can i have a form that, when click a button (or text link), the main form stays on the page submits the form in a popup window?
the reason i'm doing this is because i have fields that a user fills in and i want to show in the popup what a fax is going to look like with the users fields filled in.
01-09-2004, 08:42 PM
Try adding target="_blank" to the <form> tag or to the <a> tag to generate the "popup" window.
01-11-2004, 04:29 AM
When you make your form, you need to assign an action that runs when the form is submitted. You can do this on the line that creates the Submit button or on the <form> line itself. If done on the submit button (which doesn't have to be called Submit, here I called it btnCalc), it'd look like this:
<input name="btnCalc" type="button" value="Calculate" onClick="DoSomething()">
When the button "Calculate" is clicked, the code in the function DoSomething() is run. This is JS code directly written in the HTML page or in its own .js file, it doesn't matter.
var outW = window.open("", "newwin", "height=350, width=630");
outW.document.write("<TITLE>My Title Here</TITLE>")
outW.document.write("<hr>blah blah blah<br><hr>");
This opens a pop-up of a given size. The window is assigned to a variable outW and then that variable is used to write HTML code to the window. There are many other features you can add to the window.open() function. See any JS book for a description.