# Problem with Validating Form

**URL:** <https://forum.kirupa.com/t/problem-with-validating-form/25060>\
**Category:** flash\
**Created:** [July 9, 2003, 12:28am UTC](https://forum.kirupa.com/t/problem-with-validating-form/25060 "2003-07-09T00:28:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tranism](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tranism/32/269_2.png) [@tranism](https://forum.kirupa.com/u/tranism)\
**Post date:** [July 9, 2003, 12:28am UTC](https://forum.kirupa.com/t/problem-with-validating-form/25060/1 "2003-07-09T00:28:11Z")

</div>

Basically I’ve racked my brain out wondering why Flash isn’t validating my form. It won’t even send to the server for processing. Any help, advice would greatly be appreciated.

[AS]//MY VALIDATION FUNCTIONS  
function vEmail(){  
if(formData.submit\_by == “”){  
errBox.setMessage(“You Must Fill In Your Email Address”);  
return false;}  
else{  
if(formData.submit\_by.indexOf(".",0) == -1 || formData.submit\_by.indexOf("@",0) == -1){  
errBox.setMessage(“Your Email Address Is Not In Correct Form”);  
return false;}  
else{  
return true;}  
}  
}

function vfirstName(){  
if (formData.first == “”){  
errBox.setMessage(“Oop’s, you forgot to fill in your first name”);  
return false; }  
else {  
return true};  
}

function vlastName(){  
if (formData.last == “”){  
errBox.setMessage(“Oop’s, you forgot to fill in your last name”);  
return false; }  
else {  
return true};  
}

function vAddress(){  
if (formData.address == “”){  
errBox.setMessage(“You must enter a valid Address”);  
return false; }  
else {  
return true};  
}

function vCity(){  
if (formData.city == “”){  
errBox.setMessage(“Oop’s, you forgot to fill in your city”);  
return false; }  
else {  
return true};  
}

function vState(){  
if (formData.state == “”){  
errBox.setMessage(“Oop’s, you forgot to fill in your state”);  
return false; }  
else {  
return true};  
}

function vZip(){  
if (formData.postal == “”){  
errBox.setMessage(“Oop’s, you forgot to fill in your zip code”);  
return false; }  
else {  
return true};  
}

//MY CLEAR ALL INPUT FIELDS FUNCTION FOR MY ‘CLEAR’ BUTTON  
function clrData(){  
this.formData.submit\_by = “”;  
this.email.text = “”;  
this.formData.first = “”;  
this.firstname.text = “”;  
this.formData.last = “”;  
this.lastname.text = “”;  
this.formData.address = “”;  
this.address.text = “”;  
this.formData.apt= “”;  
this.apartment.text = “”;  
this.formData.city = “”;  
this.city.text = “”;  
this.formData.state = “”;  
this.state.text = “”;  
this.formData.postal = “”;  
this.zip.text = “”;  
}

//MY REPLY FUNCTION AFTER MESSAGE IS SUCCESSFULLY OR UNSUCCESSFULLY SENT  
function myOnLoad(success){  
errBox.setEnabled(true);  
if(success){  
errBox.setIcon(“info”);  
errBox.setTitle(“Thank You”);  
errBox.setMessage(“Thank You for joining the BCBG mailing list.”);  
errBox.\_visible=true;  
clrData();  
}  
else{  
errBox.setIcon(“warning”);  
errBox.setTitle(“System Error”);  
errBox.setMessage(“Oop’s an error occured while submitting. Please try again.”);  
errBox.\_visible=true;  
}  
}

//MY SUBMIT FUNCTION TO SEND ALL INFORMATION TO MY SCRIPT SERVER SIDE  
function goPostal(){  
if(!vEmail()){errBox.\_visible=true;return;}  
else{

```
if(!vfirstName()){errBox._visible=true;return;}
else{
		
if(!vlastName()){errBox._visible=true;return;)
else{

if(!vAddress()){errBox._visible=true;return;)
else{

if(!vCity()){errBox._visible=true;return;)
else{
					
if(!vState()){errBox._visible=true;return;)
else{
						
if(!vZip()){errBox._visible=true;return;)
	}
}
errBox.setIcon("info");
errBox.setTitle("Sending Mail");
errBox.setMessage("Your Email Is Being Submitted");
errBox._visible=true;
errBox.setEnabled(false);
formData.sendAndLoad("http://max.bcbg.com/js/flashmailscript.php", replyData, "post");

```

}[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 10, 2003, 10:44pm UTC](https://forum.kirupa.com/t/problem-with-validating-form/25060/2 "2003-07-10T22:44:55Z")

</div>

never mind. 🙂 I figured it out. I had to write the if/else statements at the end as “else if” statements. Everything works now.
