0

I am trying to validate if only alphabets are typed in a text box. The code i am using is

<mx:StringValidator id="loginValidator"     source="{loginTextField}" property="text" required="true" minLength="2" />


validatorErrorArray = Validator.validateAll([loginValidator, ...])

Now the problem is, it also validates characters like */- and ;',./ etc i want to validate only numbers and or alphabets. If anyone can point out mistake and changes that should be made

Best Regards

Muhammad Umar
  • 11,391
  • 21
  • 91
  • 193

1 Answers1

4

If you want Only Alphabets and numbers to accepted you can use restrict property.

<s:TextInput restrict="0-9a-zA-Z"/>

This will allow only numbers and alphabets.

Santhosh Nayak
  • 2,312
  • 3
  • 35
  • 65