[Elements] are optional
Class SAPO.Utility.Validator
class
SAPO.Utility.Validator
set of functions to provide validation
Defined in
Utility/Validator/0.1/lib.jsInclusion link: http://js.sapo.pt/SAPO/Utility/Validator/0.1/
Sample: http://js.sapo.pt/SAPO/Utility/Validator/sample/
Function Summary
checks if a date is valid
validates if a zip code is valid in Portugal
can function in multiple ways
Ex:
cp1 = "2000" cp1 = "2000-123" cp1 = "2000 123" cp1 = "2000" & cp2 = "123"
cp1 = "2000" cp1 = "2000-123" cp1 = "2000 123" cp1 = "2000" & cp2 = "123"
validates the function in all country codes available or in the ones set in the second param
Boolean
isPortuguesePhone()
alias function for isPTPhone
Function Details
function _isValidDate
Boolean
_isValidDate(Number
year, Number
month, Number
day)
checks if a date is valid
Parameters:
year
month
day
Returns:
true if the date is valid
function codPostal
Boolean
codPostal(Number|String
cp1, [Number|String
cp2])
validates if a zip code is valid in Portugal
can function in multiple ways
Ex:
cp1 = "2000" cp1 = "2000-123" cp1 = "2000 123" cp1 = "2000" & cp2 = "123"
cp1 = "2000" cp1 = "2000-123" cp1 = "2000 123" cp1 = "2000" & cp2 = "123"
Parameters:
cp1
[cp2]
Returns:
true if zip code is valid
function isAOPhone
Boolean
isAOPhone(String
phone)
checks if a phone is valid in Angola
Parameters:
phone
Returns:
true if the number is valid
function isCVPhone
Boolean
isCVPhone(String
phone)
checks if a phone is valid in Cabo Verde
Parameters:
phone
Returns:
true if the number is valid
function isDate
Checks is a date is valid in a given format
Parameters:
format
- defined in _dateParsers
dateStr
- date string
Returns:
true if the date is valid in the format
function isMZPhone
Boolean
isMZPhone(String
phone)
checks if a phone is valid in Mozambique
Parameters:
phone
Returns:
true if the number is valid
function isPTPhone
Boolean
isPTPhone(String
phone)
checks if a phone is valid in Portugal
Parameters:
phone
Returns:
true if the number is valid
function isPhone
Boolean
isPhone(String
phone, [String|Array
country])
validates the function in all country codes available or in the ones set in the second param
Parameters:
phone
number
[country]
or array of countries to validate
List of countries available set in _countryCodes
Returns:
true if is valid
function isPortuguesePhone
Boolean
isPortuguesePhone()
alias function for isPTPhone
function isTLPhone
Boolean
isTLPhone(String
phone)
checks if a phone is valid in Timor
Parameters:
phone
Returns:
true if the number is valid
function mail
Boolean
mail(String
email)
checks if a email is valid
Parameters:
email
Returns:
true if the email is valid
function url
Boolean
url(String
url, Boolean
full)
checks if a url is valid
Parameters:
url
full
- if true, validates a full url (one which
starts with http)
Returns:
true if the url is valid