# Textfield Validation

**URL:** https://forum.kirupa.com/t/textfield-validation/20341
**Category:** flash
**Created:** [May 7, 2003, 6:25pm UTC](https://forum.kirupa.com/t/textfield-validation/20341 "2003-05-07T18:25:57Z")
**Posts on this page:** 5
**Page:** 1

<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: [May 7, 2003, 6:25pm UTC](https://forum.kirupa.com/t/textfield-validation/20341/1 "2003-05-07T18:25:57Z")

</div>

I need to validate 3 of 4 textfields in my form. I knwo how to validate a regular text field. I am using the following code.

on(release){  
if(!name.length){  
status=“Please Enter Your Name”;  
}  
}

\*\*status=my status textfield.

Now I am not too sure on how to do it for an email. I need the email to contain “@” and “.”

Now only if all these are true the I want it to go to my email. So I need some help with finishing my if statements.

Thanks Guys.

---

<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: [May 7, 2003, 7:39pm UTC](https://forum.kirupa.com/t/textfield-validation/20341/2 "2003-05-07T19:39:39Z")

</div>

try this

```auto

on (release){
	check1 = false;
	check2 = false;
	for (i=0; i<_root.email.length; i++){
		currentChar = _root.email.charAt(i);
		if (currentChar == '@'){
			check1 = true;
		}
		if (check1 == true && currentChar == '.'){
			check2 = true;
		}
	}
	if (check2 == true){
		_root.statusfield = "valid e-mail";
	} else {
		_root.statusfield = "invalid e-mail";
	}
}

```

I used \_root.email as the variable for the input field and changed the status variable to statusfield. Status is a keyword in flash and will cause problems if you try to refer to it using \_root.

---

<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: [May 7, 2003, 9:33pm UTC](https://forum.kirupa.com/t/textfield-validation/20341/3 "2003-05-07T21:33:23Z")

</div>

ok great. thanks. this is def a new way of doing this for me. ill give it a go

🙂

happy flashing

---

<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: [May 8, 2003, 2:11pm UTC](https://forum.kirupa.com/t/textfield-validation/20341/4 "2003-05-08T14:11:23Z")

</div>

hey man this script isnt working for me?

---

<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: [May 8, 2003, 7:22pm UTC](https://forum.kirupa.com/t/textfield-validation/20341/5 "2003-05-08T19:22:32Z")

</div>

are your variables for e-mail and status targeted correctly?

Can’t really help you with why it isn’t working without more information, you may try running the debugger and looking at the variables to try to figure out what is wrong.
