ad_page_contract_filter_proc_phone (public)
ad_page_contract_filter_proc_phone name value_varname
Defined in packages/acs-tcl/tcl/tcl-documentation-procs.tcl
Checks whether the value is more or less a valid phone number with the area code. Specifically, area code excluding leading "1", optionally enclosed in parentheses; followed by phone number in the format xxx xxx xxxx (either spaces, periods or dashes separating the number). This filter matches the beginning of the value being checked, and considers any user input following the match as valid (to allow for extensions, etc.). Add a $ at the end of the regexp to disallow extensions. Examples:
- (800) 888-8888 will pass
- 800-888-8888 will pass
- 800.888.8888 will pass
- 8008888888 will pass
- (800) 888-8888 extension 405 will pass
- (800) 888-8888abcd will pass
- "" (the empty string) will pass
- 1-800-888-8888 will fail
- 10-10-220 800.888.8888 will fail
- abcd(800) 888-8888 will fail
- Parameters:
- name
value_varname
- Author:
- Randy Beggs <randyb@arsdigita.com>
- Created:
- August 2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ad_page_contract_filters
Source code: upvar $value_varname value if { [string trim $value] ne "" } { if { ![regexp {^\(?([1-9][0-9]{2})\)?(-|\.|\ )?([0-9]{3})(-|\.|\ )?([0-9]{4})} $value] } { ad_complain [_ acs-tcl.lt_value_does_not_appear] return 0 } } return 1XQL Not present: Generic, PostgreSQL, Oracle