Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to
Did You Find This Entry Useful?

2 of 4 people (50%) answered Yes
Recently 2 of 4 people (50%) answered Yes


How to submit form first to a popup for preview, close popup and then submit to a next page?

Apr 9th, 2008 20:30
ha mo, Dave Clark, Luda K,

     It would require coordination with your server-side code in order 
to accomplish this.  The server-side code would need to recognize a 
hidden field in the for which designates whether the submission of for 
preview or for final update.  For example, the following is a dummy 
example of the main form page:
<form action="somepage.php" target="_blank">
    <input type="hidden" name="update" value="preview">
     That would submit to a popup page.  You could even include 
an "onsubmit" event in the form tag to customize the popup window.  
Then, your server-side code would include JavaScript and two buttons 
in the preview output -- such as the following:
<button type="button" onclick="return Finalize()">Finalize</button>
<button type="button" onclick="return Revise()">Revise</button>
     This would be the JavaScript associated with those two buttons:
function Finalize()
    var f = top.opener.document.forms[0];
    f.elements['update'].value = 'final'; = '_self';
    return true;
function Revise()
    return true;
Take care,
Dave Clark