org.sakaiproject.profile2.tool.components
Class PhoneNumberValidator

java.lang.Object
  extended by org.apache.wicket.validation.validator.AbstractValidator
      extended by org.sakaiproject.profile2.tool.components.PhoneNumberValidator
All Implemented Interfaces:
Serializable, org.apache.wicket.IClusterable, org.apache.wicket.validation.INullAcceptingValidator, org.apache.wicket.validation.IValidator

public class PhoneNumberValidator
extends org.apache.wicket.validation.validator.AbstractValidator

Validator for checking a phone number. There are many different types so the check is pretty loose.

For instance, the following are valid Australian formats for the same number:
1. +61 2 1234 5678 (abbreviated international number)
2. 0011 61 2 1234 5678 (full international number)
3. 02 1234 5678 (expanded area code)
4. (02) 1234 5678 (expanded area code)
5. 1234 5678 (if calling in 02 areacode)

plus all of the above without spaces.

Also added the following style numbers:
6. 111-222-3333
7. 111.222.3333
8. (111) 222-3333-444
9. (111) 222.3333.444

plus combinations of . and - in the same numbers above

Now for numbers with extensions, add (\\w+)?+ 10. All of the above with any letter/number combo afterwards but it must start with a letter and not contain spaces and only occur once or not at all eg (123-456-789 x123, 123 456 789 ext5)

Author:
Steve Swinsburg (steve.swinsburg@gmail.com)
See Also:
Serialized Form

Constructor Summary
PhoneNumberValidator()
           
 
Method Summary
protected  void onValidate(org.apache.wicket.validation.IValidatable validatable)
           
 
Methods inherited from class org.apache.wicket.validation.validator.AbstractValidator
error, error, error, error, messageModel, resourceKey, resourceKey, validate, validate, validateOnNullValue, variablesMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhoneNumberValidator

public PhoneNumberValidator()
Method Detail

onValidate

protected void onValidate(org.apache.wicket.validation.IValidatable validatable)
Specified by:
onValidate in class org.apache.wicket.validation.validator.AbstractValidator
See Also:
AbstractValidator.onValidate(IValidatable)


Copyright © 2008-2012 The Sakai Foundation. All Rights Reserved.