Entry
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,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Luda,
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">
<fieldset>
<input type="hidden" name="update" value="preview">
...etc...
</fieldset>
</form>
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';
f.target = '_self';
f.submit();
self.close();
return true;
}
function Revise()
{
self.close();
return true;
}
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.healthinhealth.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com