# Form Validation

**URL:** <https://forum.kirupa.com/t/form-validation/25029>\
**Category:** Uncategorized\
**Created:** [July 8, 2003, 6:33pm UTC](https://forum.kirupa.com/t/form-validation/25029 "2003-07-08T18:33:31Z")\
**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 8, 2003, 6:33pm UTC](https://forum.kirupa.com/t/form-validation/25029/1 "2003-07-08T18:33:31Z")

</div>

I got a problem. My form Validation isn’t working. Actually to be more accurate, the chEmail function works but I also need Flash to check the input fields “first” and “last” to make sure something is entered in there? Am I missing something here or done something wrong? Thanks peeps

Here’s the code related to the validation

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

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

function ckEmail(){  
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;}  
}

}

---

<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 8, 2003, 7:21pm UTC](https://forum.kirupa.com/t/form-validation/25029/2 "2003-07-08T19:21:52Z")

</div>

Don’t know if this well help, but instead of saying formData.first == “”, you could try

```auto

if(formData.first){
     the good stuff
}else{
     the bad stuff (error message)
}

```

Saying if(formData.first) will ask if there is anything there (same as nonzero).
