Class TFormTextPhone

Description

Text Field, formats as a phone number (north america)

Only accepts 7 digits "123-4567", 10 digits "(123) 456-7890", or more "(123) 456-7890 x123..", with the exception of a "1" at the start

  • version: 03-08-2002 12:00
  • author: Greg MacLellan

Located in /form-text-phone.inc.php (line 17)

TFormElement
   |
   --TFormText
      |
      --TFormTextPhone
Variable Summary
mixed $allow1
mixed $areacode
mixed $isvalid
Method Summary
TFormTextPhone TFormTextPhone (string $name, string $displayname, string $class, bool $required, [int $areacode = ""], [array $allow1 = null], [string $value = ""], [bool $store = true])
true setValue (mixed $value, [bool $user = false])
Boolean validate ()
Variables
Methods
Constructor TFormTextPhone (line 45)

Creates a new TFormTextPhone element (phone number input field).

TFormTextPhone TFormTextPhone (string $name, string $displayname, string $class, bool $required, [int $areacode = ""], [array $allow1 = null], [string $value = ""], [bool $store = true])
  • string $name: The name of the element. This should correspond to the field names if using with TDBForm, and should not include any spaces or special characters.
  • string $displayname: The name that should show up to the user for this field.
  • string $class: The HTML Class to use for the element
  • bool $required: True if the field has to be filled in
  • int $areacode: The default area code to use if none is entered. If this is blank, area code is not added unless user entered it
  • array $allow1: This is an array of area codes that are formatted differently. if an area code is in this array, it is printed as "1-800-123-4567", otherwise, it is printed as "(123) 123-4567". Leaving this as null will put the default set in
  • string $value: The initial value for the field. Note if using a TDBForm this value will be overridden by loadValues so it is effectively only the default for new entries.
  • bool $store: Whether this value is persistent. Used by TDBForm to decide to save/load this value from database.
setValue (line 63)

Sets the value of the field

  • return: if the value was set
true setValue (mixed $value, [bool $user = false])
  • mixed $value: The value to set
  • bool $user: True if the value is from user input

Redefinition of:
TFormElement::setValue()
Sets the value of the field
validate (line 155)

Validates the data in this field.

  • return: True if the data is valid, or a string containing an error message if there is a problem.
Boolean validate ()

Redefinition of:
TFormText::validate()

Inherited Methods

Inherited From TFormText

TFormText::TFormText()
TFormText::output()
TFormText::setRegex()
TFormText::validate()

Inherited From TFormElement

TFormElement::TFormElement()
TFormElement::getValue()
TFormElement::output()
TFormElement::setParent()
TFormElement::setValue()
TFormElement::validate()

Documentation generated on Thu, 27 Nov 2003 14:58:59 -0500 by phpDocumentor 1.2.3