Groups | Blog | Home
all groups > flash actionscript > january 2004 >

flash actionscript : form validation in flash mx


honestnotes
1/25/2004 5:06:53 PM
i've created a simple form in flash that is hooked to a scrpit that handles the information but i wish for flash to validate some basic info before it is submitted to the script.
i tired using the "if" command but could not get it to work.
What is the action I need to put in in order to have it check if there's a "@" included in an email field for example ? I know the == command but what about "isf a certain symbol included i nthe field, Then ..." type of command ?

Thank you for your help
s.



MarxEinstein
1/25/2004 5:18:39 PM
if(mailText.indexOf("@")<>-1){
// included @
.......
}else{
//no @
......
}

honestnotes
1/25/2004 5:40:25 PM
thanks for your reply
this is not working for me - maybe i am not changing the right parameters.
the valiable i need to check is named "email"
please advice
thank u again .


MarxEinstein
1/25/2004 5:52:42 PM
if(email.indexOf("@")<>-1){
........

what is type of the variable "email"?


honestnotes
1/25/2004 5:55:37 PM
it's an input text var.
is that ok ?

MarxEinstein
1/25/2004 6:04:13 PM
I have tested in my computer,it's Ok.

.......



honestnotes
1/25/2004 6:14:26 PM
It works - THANK YOU SO SO SO SO MUCH !
Peace
s.

honestnotes
1/25/2004 7:37:13 PM
While we are here let me ask you tow more quick questions regarding this matter :
How do i validate a var to include only numerals?
and also how do i sting all of these validations together? I need something like
if A does not include B the B=_______, and if X does not include y then X=___________ ( etc... ) -
else >>>>>> ....

thanks for your help.
s.


honestnotes
1/26/2004 3:33:57 PM
help anyone ?


MarxEinstein
1/26/2004 3:53:29 PM
It is an easy job, it can be done without ActionScript.Select the inputText, and look at the properties window, there is a button named "character", press it , and you can define what letters can be fill in the inputText. you can defined "1234567890", and users can not type any other letters in you inputText but Numbers.

AddThis Social Bookmark Button