|
Hi Guys,
I have 2 javascript codes that I want to work together because they both use onsubmit ... the first is a "input all fields" code and the 2nd is a "popup in new window" code. They both work but what the new pop up window opens even after the message is given that the user needs to fill in all required fields. I am trying to connect both codes so here is what it looks like: i know i need to change something on the window.open code but im not sure what, anyway here is the code that i have in the <head> section:
<script type="text/javascript">
<!-- Start
function verify() {
var message = "In order for this form to be submitted all fields are required to be filled. Please complete the following field(s):"+'\n'+""+'\n'+""
if (document.form.FirstName.value=="") {
message = message + "Your First Name,"+'\n'+"";
}
if (document.form.EmailAddress.value=="") {
message = message + "Email Address,"+'\n'+"";
}
if (document.form.DomainName.value=="") {
message = message + "Registered Domain Name of your Mini-Site,"+'\n'+"";
}
//alert if fields are empty and cancel form submit
if (message == "In order for this form to be submitted all fields are required to be filled. Please complete the following field(s):"+'\n'+""+'\n'+"") {
document.form.submit();
}
else {
alert(message);
return false;
}
}
function createTarget(t)
{
window.open("", t, "width=200,height=100,left=505,top=2,");
return true;
}
// End -->
</script>
I don't think anything needs to be changed in the <body> section, i just basically need to tell this popup window to only open if all required fields have been filled because whats happening is that the message comes up prompting the user to fill all fields but the popup window opens after with the "thank you for submitting this form" message in it... which makes no sense. Please let me know what needs to be added to this code so that it will work. Thanks
|