...

View Full Version : Popup window on submit form



Gunit2507
08-23-2004, 11:55 PM
I am VERY new to javacsript. I am validating a form onsubmit and then i want the new window to popup in a new winow... This is what i have:

<script language="JavaScript">
function validate(returnvalue)
{
//Validation Control Center
//Use validateNotEmpty(fieldname,errormessage) to check if the field is empty
//Use validateEMailCheck(fieldname,errormessage) to check if the email address is valid
//These must go inside if statement
var anError
if (validateNotEmpty(document.MailingList.Email.value,"You must enter your e-mail address")==false)
{
anError=true
}
else
{
if (validateEMailCheck(document.MailingList.Email.value,"You must enter a valid e-mail address for yourself")==false)
{
anError=true
}
else
{
if(document.MailingList.SportsMailing.checked==false && document.MailingList.GamingMailing.checked==false)
{
alert("You must choose at least one topic");anError=true;
}
}
}
if (anError==true)
{
return false;
}
else
{
open.window(' ','Mailing',"width=452,height=325,scrollbars=no")
return true;
}
}

But i can not get the action="" of the form to make it in a new window... is there a way of doing it!?

glenngv
08-24-2004, 05:43 AM
<script type="text/javascript">
function validate(objForm, returnvalue)
{
//Validation Control Center
//Use validateNotEmpty(fieldname,errormessage) to check if the field is empty
//Use validateEMailCheck(fieldname,errormessage) to check if the email address is valid
//These must go inside if statement
var anError
if (validateNotEmpty(objForm.Email.value,"You must enter your e-mail address")==false)
{
anError=true;
}
else if (validateEMailCheck(objForm.Email.value,"You must enter a valid e-mail address for yourself")==false)
{
anError=true
}
else if(objForm.SportsMailing.checked==false && objForm.GamingMailing.checked==false)
{
alert("You must choose at least one topic");
anError=true;
}
if (anError==true)
{
return false;
}
else
{
var w = window.open('', objForm.target, "width=452,height=325,scrollbars=no");
w.focus();
return true;
}
}
</script>
...
<form name="MailingList" action="process.php" target="MailingListPopup" onsubmit="return validate(this, returnvalue)">
...
<input type="submit" value="Submit" />
</form>

I don't know the use of returnvalue argument in the validate() function. You don't use it inside the function.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum