# Form Validation

**URL:** <https://forum.kirupa.com/t/form-validation/65215>\
**Category:** Uncategorized\
**Created:** [September 24, 2004, 1:39am UTC](https://forum.kirupa.com/t/form-validation/65215 "2004-09-24T01:39:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arturo](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/arturo/32/761_2.png) [@arturo](https://forum.kirupa.com/u/arturo)\
**Post date:** [September 24, 2004, 1:39am UTC](https://forum.kirupa.com/t/form-validation/65215/1 "2004-09-24T01:39:18Z")

</div>

Hi guys, I’ve a problem, I’ve a form in flash, built with Input Text Fields, my Variables are:

Nombres  
Apellidos  
Empresa  
Telefono  
Email  
Ciudad  
Comentarios

and I want to validate all the fields before somebody submits the button, how I can do this?

thanks!

---

<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:** [September 24, 2004, 7:52am UTC](https://forum.kirupa.com/t/form-validation/65215/2 "2004-09-24T07:52:46Z")

</div>

maybe you can check the input in the button like:

somebutton\_bnt.onRelease = function(){  
if(Nombres == “”){  
trace(“please give your name”);  
}elseif(Apellidos == “”){  
trace(“please give your ??? last name?”);  
//repeat the elseif for every field  
} else {  
trace(“the form was OK, submit”);  
}  
}

---

<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:** [September 24, 2004, 3:00pm UTC](https://forum.kirupa.com/t/form-validation/65215/3 "2004-09-24T15:00:30Z")

</div>

> [@pietertje](#):
>
> maybe you can check the input in the button like:
> 
> somebutton\_bnt.onRelease = function(){  
> if(Nombres == “”){  
> trace(“please give your name”);  
> }elseif(Apellidos == “”){  
> trace(“please give your ??? last name?”);  
> //repeat the elseif for every field  
> } else {  
> trace(“the form was OK, submit”);  
> }  
> }

thanks a lot, based in your example, I’m doing this:

envio\_btn.onRelease = function() {  
if(Nombres == “”){  
alert\_txt=“please give your name”;  
} else {  
gotoAndPlay(“accion”);  
}  
}  
but in the Output panel I’m with this message:

**Error** Scene=main, layer=Layer 1, frame=1:Line 5: Statement must appear within on handler  
envio\_btn.onRelease = function() {  
Total ActionScript Errors: 1 Reported Errors: 1

why is this happening?

Thanks dude

---

<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:** [September 25, 2004, 2:02am UTC](https://forum.kirupa.com/t/form-validation/65215/4 "2004-09-25T02:02:58Z")

</div>

ummm…ur code is working fine for me. Are u sure u are placing ur code in the timeline??, and not in the object?
