Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

form checking input email and number values in flash

Posted on 2006-07-14
2
Medium Priority
?
200 Views
Last Modified: 2010-04-03
Hi experts,

As title I would like to know how to check in flash:

1) a text field 'phone' is number or not
2) a text field 'email' has the correct email format or not (with the @ and '.')

Thanks~!
0
Comment
Question by:huang_ck
2 Comments
 
LVL 7

Accepted Solution

by:
furmiga earned 2000 total points
ID: 17113367
Hi there!


Answering n.1 - If you want just numbers in your phone text field then just select the range of the characters allowed to be typed in the field. (In the imput text properties, you will find a button named "characters...", hit "Specify Ranges" and then click "Numerals[0..9]..." then hit OK.

Answering n.2 - This is a bit more complicated. You can set any verifications but still you can't prevent from a wrong imput.

on(release) // simple button action
{
    if((email.text.indexOf("@") == -1) or (email.text.charAt(0) == ".") or (email.text.charAt(0) == "@") or (email.text.indexOf(".") == -1))
    {
        trace("Wrong email format.")
    }
}

Here the email field can't start with "." or with"@" and must have both along the string. This is enuf to make you imput an correct email format. Again, this won't prevent users from type "damn_email@verification.com" with im pretty sure doesn't exist :)

Thats it. Anything just gimme a call


Ralph
0
 

Author Comment

by:huang_ck
ID: 17123081
cool thanks~!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question