Posted By

mprabhuram on 07/28/09


Tagged


Versions (?)

Flex Data Validator - Phone number validator


 / Published in: ActionScript 3
 

Use this as a sample script to code flex data validations

  1. private var phoneValidator:PhoneNumberValidator;
  2.  
  3. private function creationCompleteHandler():void
  4. {
  5. //
  6. // Create validators
  7. //
  8. // Phone validator
  9.  
  10. phoneValidator = new PhoneNumberValidator();
  11. phoneValidator.source = phoneInput;
  12. phoneValidator.property = "text";
  13.  
  14. }
  15.  
  16.  
  17. <mx:Panel title="Phone number validator">
  18. <mx:Form>
  19. <mx:FormItem label="Name:">
  20. <mx:TextInput
  21. id="nameInput"
  22. />
  23. </mx:FormItem>
  24. <mx:FormItem label="Phone: ">
  25. <mx:TextInput
  26. id="phoneInput"
  27. />
  28. </mx:FormItem>
  29. <mx:FormItem label="Email: ">
  30. <mx:TextInput
  31. id="emailInput"
  32. />
  33. </mx:FormItem>
  34. </mx:Form>
  35. </mx:Panel>

Report this snippet  

You need to login to post a comment.