# Form Validation

**URL:** <https://forum.kirupa.com/t/form-validation/62657>\
**Category:** Uncategorized\
**Created:** [August 30, 2004, 10:37am UTC](https://forum.kirupa.com/t/form-validation/62657 "2004-08-30T10:37:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hemagfx](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@Hemagfx](https://forum.kirupa.com/u/Hemagfx)\
**Post date:** [August 30, 2004, 10:37am UTC](https://forum.kirupa.com/t/form-validation/62657/1 "2004-08-30T10:37:43Z")

</div>

How do i validation fields in flash text fields, numeric, date, time and email.

---

<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:** [August 30, 2004, 10:23pm UTC](https://forum.kirupa.com/t/form-validation/62657/2 "2004-08-30T22:23:56Z")

</div>

numeric you would assign the text box value a variable (ie. _Tbox_) and then use this AS

```auto
if(isNaN(Tbox)){
    trace(Tbox+" - This is not a numeric value (ie. Not a Number - NaN)
}

```

as for date and time ive no idea… maybe use a for loop (as below) and check each character (again as below) but rather than checking against an array, check to see if it is a number (as above) and if it is not, _then_ check it against an array to see if it is a colon for example…?

email is a bit more tricky… lets say your searching for the @ sign and a . after the @ somewhere…  
use a loop to evaluate each character of the variable you have set equal to the text box (again using _Tbox_)

```auto
myArray = new Array("@",".") //sets up an array with the characters we want to check in the order we want to check them
x=0 //resets the validation index
for(i=0;i<Tbox.length;i++){ //sets up a loop
	if(Tbox.charAt(i)==myArray[x]){//checks the variable, character by character for the character defined in our array
		trace(myArray[x]+" is at the location: "+i) //tells you where the character in question is (optional)
		x++ //starts looking for the next character in our array
	}
}
//the below is an optional output if the email is incorrect format
if(x<myArray.length){
	trace("sorry, we did not recognise your email address as valid")
}

```

hope this has helped you a bit 😉

Prophet.
