I want to press a submit button on a form and then a pop-up Window opens
to process the form data.
I have a form with this HTML code:
<form action="/test.php" method="post" name="testform" onSubmit="newWi ndowForm('testf orm')">
And here is the javascript for the top of the page:
function newWindowForm(f ormname)
{
//alert(formname) ;
var popUp = window.open ('','popUp','sc rollbars=no,res izable=no,width =450,height=350 ');
document.formna me.target = 'popUp';
}
The problem is this line:
document.formna me.target = 'popUp';
I've obviously got the syntax wrong. I've checked that the "formname" parameter
is being passed to the javascript, it is. You can test it by using the
"alert(formname );" line to see what it is.
A quick way to fix this is to harcode the formname into the javascript:
document.testfo rm.target = 'popUp';
However, there will be lots of these forms in my website and I want
to use 1 piece of code for each form, instead of coding each javascript.
Can this be done?
Cheers
to process the form data.
I have a form with this HTML code:
<form action="/test.php" method="post" name="testform" onSubmit="newWi ndowForm('testf orm')">
And here is the javascript for the top of the page:
function newWindowForm(f ormname)
{
//alert(formname) ;
var popUp = window.open ('','popUp','sc rollbars=no,res izable=no,width =450,height=350 ');
document.formna me.target = 'popUp';
}
The problem is this line:
document.formna me.target = 'popUp';
I've obviously got the syntax wrong. I've checked that the "formname" parameter
is being passed to the javascript, it is. You can test it by using the
"alert(formname );" line to see what it is.
A quick way to fix this is to harcode the formname into the javascript:
document.testfo rm.target = 'popUp';
However, there will be lots of these forms in my website and I want
to use 1 piece of code for each form, instead of coding each javascript.
Can this be done?
Cheers
Comment