meg33
08-26-2002, 06:49 PM
Hi,
This is my problem, I have a pop up form and I want the pop up close after clicking on the submit button.
For now when I click on the submit button there is a form validation in javascript. I dont know if I can add some code in that script to tell the navigator to close the window.
there is my code :
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var submitcount=0;
function reset() {
document.spareparts.FirstName_.value="";
document.spareparts.LastName_.value="";
document.spareparts.Email_.value="";
document.spareparts.Phone_.value="";
}
function checkFields() {
if ( (document.spareparts.Email_.value.indexOf("@") == -1 ||
document.spareparts.Email_.value.indexOf(".") == -1) )
{
alert("Please enter a proper email address.");
return false;
}
else if
( (document.spareparts.FirstName_.value=="") ||
(document.spareparts.LastName_.value=="") ||
(document.spareparts.Phone_.value=="") )
{
alert("Please enter your name and phone number then re-submit this form.");
return false;
}
else
{
if (submitcount == 0)
{
submitcount++;
return true;
}
else
{
alert("This form has already been submitted. Thanks!");
return false;
}
}
}
// End -->
</script>
I wish someone can help me,
thanks
This is my problem, I have a pop up form and I want the pop up close after clicking on the submit button.
For now when I click on the submit button there is a form validation in javascript. I dont know if I can add some code in that script to tell the navigator to close the window.
there is my code :
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var submitcount=0;
function reset() {
document.spareparts.FirstName_.value="";
document.spareparts.LastName_.value="";
document.spareparts.Email_.value="";
document.spareparts.Phone_.value="";
}
function checkFields() {
if ( (document.spareparts.Email_.value.indexOf("@") == -1 ||
document.spareparts.Email_.value.indexOf(".") == -1) )
{
alert("Please enter a proper email address.");
return false;
}
else if
( (document.spareparts.FirstName_.value=="") ||
(document.spareparts.LastName_.value=="") ||
(document.spareparts.Phone_.value=="") )
{
alert("Please enter your name and phone number then re-submit this form.");
return false;
}
else
{
if (submitcount == 0)
{
submitcount++;
return true;
}
else
{
alert("This form has already been submitted. Thanks!");
return false;
}
}
}
// End -->
</script>
I wish someone can help me,
thanks