FORMfields


FORMfields.fields.PhoneNumberField

Class PhoneNumberField

FormField
|
+--PhoneNumberField

public class PhoneNumberField
extends FormField

PhoneNumberField is a field for editing an American office phone number in the form, "AAA-BBB-CCCC xDDDDD". The extension is optional.

Since:
FORMfields v1.0

Field Summary
mixed

$SIZE_PHONE_EXT

The maximum length of the phone extension.

mixed

$ext

The sub field for the extension of the phone number.

mixed

$p1

The sub field for the 1st part of the phone number.

mixed

$p2

The sub field for the 2nd part of the phone number.

mixed

$p3

The sub field for the 3rd part of the phone number.

mixed

$subFieldDisplayValueSeparator

The string used to separate the display value parts.

mixed

$subFieldSeparator

The string used to separate the sub fields.

mixed

$subFieldsCannotBeEmpty

True if an empty sub field constitutes an invalid value.

Fields inherited from FORMfields.fields.FormField
autoPropagate, data, disableEnterHandler, displayValuesOnNewLine, editable, enabled, endingString, enterTabHandler, enterTabs, error, extraHtml, fieldBelowLabel, formError, help, hidden, htmlify, id, isData, label, labelForId, multiValues, name, required, subFieldDisplayValueSeparator, subFieldSeparator, subFieldValueSeparator, subFields, subFieldsCannotBeEmpty, trimWhitespace, validators, value, valueIsHtml
Constructor Summary

PhoneNumberField(string name, string label, int required)

Creates a new PhoneNumberField.

__construct(string name, string label, int required)

Creates a new PhoneNumberField.

Method Summary
string

getDisplayValue()

Returns the display value of this field.

string

getEditableFieldTag()

Returns the HTML used to display the input portion of this field.

boolean

isValid()

Checks for field errors detected by this field, including a check for blank.

void

setValue(string value)

Sets the value of this form field.

Methods inherited from FORMfields.fields.FormField
addFieldValidator, addSubField, checkForBlank, clearValue, disable, formatRequestParameter, formatText, getButtonClicked, getData, getDbValue, getDisableFieldJs, getDisableJs, getDisableLabelJs, getDisplayFieldTag, getDisplayHtmlValue, getDisplayLabelTag, getDisplayValue, getEditable, getEditableFieldTag, getEditableLabelTag, getEnabled, getError, getExtraHtml, getFieldTag, getFormError, getHelp, getHelpTag, getHidden, getHiddenFieldTag, getId, getIsData, getIsHidden, getLabel, getLabelHtml, getLabelTag, getName, getOrNull, getParameter, getRawDbValue, getRequired, getValue, isBlank, isEmpty, isValid, setAutoPropagate, setData, setDbValue, setDisplayValuesOnNewLine, setEditable, setEnabled, setEndingString, setError, setExtraHtml, setFieldBelowLabel, setFormError, setHelp, setHidden, setHtmlify, setId, setIsData, setIsHidden, setLabel, setName, setRequired, setTrimWhitespace, setValue, setValueIsHtml, validate

Field Detail

SIZE_PHONE_EXT

public mixed $SIZE_PHONE_EXT = 5

The maximum length of the phone extension.

Since:
FORMfields v1.0

ext

public mixed $ext = null

The sub field for the extension of the phone number.

Since:
FORMfields v1.0

p1

public mixed $p1 = null

The sub field for the 1st part of the phone number.

Since:
FORMfields v1.0

p2

public mixed $p2 = null

The sub field for the 2nd part of the phone number.

Since:
FORMfields v1.0

p3

public mixed $p3 = null

The sub field for the 3rd part of the phone number.

Since:
FORMfields v1.0

subFieldDisplayValueSeparator

public mixed $subFieldDisplayValueSeparator = "-"

The string used to separate the display value parts.

Since:
FORMfields v3.0

subFieldSeparator

public mixed $subFieldSeparator = " - "

The string used to separate the sub fields.

Since:
FORMfields v3.0

subFieldsCannotBeEmpty

public mixed $subFieldsCannotBeEmpty = false

True if an empty sub field constitutes an invalid value.

Since:
FORMfields v3.0

Constructor Detail

PhoneNumberField

public PhoneNumberField(string name, string label, int required)

Creates a new PhoneNumberField.

Parameters:
name - the name of the form field. This value must not be a SQL reserved word and should follow all the standard variable naming conventions in PHP.
label - this form field's label. The label is the printable text that is typically displayed on the left side of the field.
required - Sets whether the field must be filled in and whether it looks like it must be filled in: FORM_FIELD_REQUIRED, FORM_FIELD_NOT_REQUIRED, FORM_FIELD_LOOKS_REQUIRED or FORM_FIELD_REQUIRED_NO_LOOK
See Also:
FORM_FIELD_REQUIRED
FORM_FIELD_NOT_REQUIRED
FORM_FIELD_LOOKS_REQUIRED
FORM_FIELD_REQUIRED_NO_LOOK
Since:
FORMfields v1.0
Deprecated:
deprecated as this constructor syntax is not expected in PHP 5 - will be removed once PHP 5 becomes a minimum requirement for FORMfields

Method Detail

getDisplayValue

public string getDisplayValue()

Returns the display value of this field. For example, the field may have a value of "2127348943" and its display value could be "212-734-8943".

Returns:
the display value of this field
Since:
FORMfields v1.0

getEditableFieldTag

public string getEditableFieldTag()

Returns the HTML used to display the input portion of this field.

Returns:
the HTML used to display the input portion of this field
Since:
FORMfields v1.0

isValid

public boolean isValid()

Checks for field errors detected by this field, including a check for blank. If an error is detected, the setError() method is called to set the appropriate error message.

Returns:
true if there is an error or false otherwise
Since:
FORMfields v3.0

setValue

public void setValue(string value)

Sets the value of this form field.

Parameters:
value - a phone number in the form "XXXYYYZZZZ", where X, Y and Z are digits
Since:
FORMfields v1.0

FORMfields