actionscript 3 - AS3 validate form fields? -


I wrote an AS3 script, I have 2 feeds to validate, i.e. Email and name

To use email:

  isValidEmail (email: string): boolean {var emailExpression: RegExp = / ^ [az <[w -] + @ \ W [\ w .-] \ [\ w .-] * [az] [az] $ / i Return emailxpress Test (email); }  

How about the name field? Can you show me some sample codes?

Edit:

are invalid:

  • Empty

  • between 4 - 20 characters

  • Alphanumeric only (special characters are not allowed)

  • should start with the alphabet

  • I think you might want a function like this:

    That regular expression stays:

    • [a-zA-Z] - The first letter is a normal letter
    • [\ u00c0- \ u01ffa-zA-Z '] - Checks if all other characters are Unicode characters or spaces. Then the name like " Mc'Neelan " will work.
    • {420} - Ensure that the name is between 4 to 20 characters in length.

    If you do not want an empty space, you can remove the location at the beginning of the middle part.

    Hope it helps. Here are my references:


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -