Wait! Before you give me the old target=“_blank” line… please read what I’m trying to accomplish.
Basically, I have a form with two submit buttons. One is called “Save”, and the other is “Preview”. I want the “Save” button to submit the form using normal means (replace the current window)… but the “Preview” button must submit the form into a new window.
Can this be done? I started a thread about this in the HTML forum, and some have said it can be done via javascript, so here I am.
Can I pass the form contents (input tags, etc…) to some kind of javascript function and then have the form submit into a new window? Will I still be able to have the “Save” button NOT open a new window?
Here’s the code I have right now. This basically is just two buttons that open the form into the same window. It’s the Save button that I want to open up into a new window only.
:
I don’t think your example will work. All it does is open a new html page into a new window. What I would like to do is submit the form into a new window ONLY if the Preview button is clicked.
Well, assuming you want the new window to simply preview the contents of the form. You can use what weirdbeard posted. All you have to do in previewpage.html is get the form contents of the opener window. Lets say you had a textarea like on this forum.
I do have a similiar problem, 1 form, 4 buttons - with a preview button to preview the form entries. The window.opener is handy but I can’t use it because the contents of the textareas are modified by a PHP-Script (regular expressions etc.).
<INPUT TYPE=“image” NAME=“preview” VALUE=“preview” ONCLICK=“javascript:window.open(‘preview.php’,‘preview’,‘width=800,height=700’);”>
does neither open a window nor interpret the PHP Script.
A preview in a new window would be a pretty solution. Does anybody have an idea ?
Thanks.