On submit open a new window and pass form variables?

Hi,

I have a form in my page, and I need to open a new window when a submit button clicked.
The form variables need to be passed too.

Anyone have a JavaScript that can do this?

Thanks
LVL 1
g118481Asked:
Who is Participating?
 
anandkpCommented:
use javascript to open a new window ... give window a name there
<A HREF="##" onClick="window.open('popup.htm?Img=anand.jpg','popup','scrollbars=yes,resizable=yes,width=500,height=350,left=0,top=0');document.frm.submit();return false">

like the name here is "popup"

& have ur form like this ...
<form name="frm" action="popup" method="post">
;
;
;
;
</form>
0
 
PluckaCommented:
Hi g118481,

You don't need javascript, unless you want to do something special with the window.

All you need is to specify the target on the form and it will pop into a new window.

<form target="_blank" name="test">

Le me know if you need further assistance.

Regards
Plucka
0
 
James RodgersWeb Applications DeveloperCommented:
Plucka is right you don't need javascript to do this

you will nedd javascript if you want to change the form page on a successful submission
parent.location.href="path/to/newpage.cfm";

or if the new window is to be closed after a successful submission
place at bottom of page!! or set a timer to execute as a function

window.close(); //only works on child windows
0
 
g118481Author Commented:
Anandkp,

I like your suggestion.
Can you explain further?

Cheers
0
 
g118481Author Commented:
Anandkp,

How do I incorporate the link part of your suggestion to the submit button of my form on the main page?
I just don't understand what configuration you are suggesting.  Please explain further.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.