AS3 validate form fields?

Posted by show on Stack Overflow See other posts from Stack Overflow or by show
Published on 2009-05-05T14:37:42Z Indexed on 2010/05/29 20:02 UTC
Read the original article Hit count: 219

Filed under:
|
|

Hi,

I wrote a AS3 script, i have 2 fields to validate, i.e email and name.

For email i use:

function isValidEmail(Email:String):Boolean { var emailExpression:RegExp = /^[a-z][\w.-]+@\w[\w.-]+.[\w.-]*[a-z][a-z]$/i; return emailExpression.test(Email); }

How about name field? Can you show me some sample code?

EDIT:

Invalid are:

  • blank

  • between 4 - 20 characters

  • Alphanumeric only(special characters not allowed)

  • Must start with alphabet

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about validation