SPS Home > Dgreath > Business Rules > isPhoneNumber() |
isPhoneNumber() Rule |
---|
The following snippet implements a business rule
that returns true if a given form element value is a valid phone number formation and
returns false if it is not. This function strips all non numeric
characters from the input string, then checks for a length of either seven or ten integers. It does
not confirm the validity of the submitted number.
Specify the form's name in formName and the element's name in elementName. |
Suggested Usage |
The following snippet demonstrates suggested code for typical validation summary
applications. The variable msg is a previously instantiated string
that holds the accumulating list of validation errors to be displayed. This example assumes
element "text1" of form "demo" is to be validated. |
The following snippet demonstrates suggested code for adjacent error message
applications. This example assumes element "text1" of form "demo" is to be
validated with the results posted to an ajacent span tag "error1". (example: |