FORMfields


FORMfields.fields.EmailAddrField

Class EmailAddrField

FormField
|
+--TextField
|
+--EmailAddrField

public class EmailAddrField
extends TextField

EmailAddrField is a field for editing an email address. This field accepts email addresses in the form: user@example.com
User <user@example.com>
'User' <user@example.com>
user@example (if strict validation is turned off)

Since:
FORMfields v1.0

Field Summary
mixed

$MAX_SIZE

The maximum length permitted.

mixed

$REGEX_EMAIL_ADDR

A regular expression used to represent an email address.

mixed

$REGEX_EMAIL_ADDR_STRICT

A regular expression used to represent an email address that must have a dot in the domain.

mixed

$strictValidation

True if a dot must be in the domain name of the email addres.

Fields inherited from FORMfields.fields.TextField
maxLength, minLength, size
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

EmailAddrField(string name, string label, int required)

Creates a new EmailAddrField.

__construct(string name, string label, int required)

Creates a new EmailAddrField.

Method Summary
boolean

isValid()

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

Methods inherited from FORMfields.fields.TextField
getEditableFieldTag, isValid
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

MAX_SIZE

public mixed $MAX_SIZE = 50

The maximum length permitted.

Since:
FORMfields v1.0

REGEX_EMAIL_ADDR

public mixed $REGEX_EMAIL_ADDR = "/^(_|-|\\.|'|[0-9]|[a-z]|\\+)+@(_|-|\\.|'|[0-9]|[a-z])+\$/i"

A regular expression used to represent an email address.

Since:
FORMfields v1.0

REGEX_EMAIL_ADDR_STRICT

public mixed $REGEX_EMAIL_ADDR_STRICT = "/^(_|-|\\.|'|[0-9]|[a-z]|\\+)+@(_|-|\\.|'|[0-9]|[a-z])+?\\.(_|-|\\.|'|[0-9]|[a-z])+?\$/i"

A regular expression used to represent an email address that must have a dot in the domain.

Since:
FORMfields v1.0

strictValidation

public mixed $strictValidation = true

True if a dot must be in the domain name of the email addres. Defaulted to true.

Since:
FORMfields v1.0

Constructor Detail

EmailAddrField

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

Creates a new EmailAddrField.

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

isValid

public boolean isValid()

Checks for field errors detected by this field, including a check for blank. This method ensures that the email address is in one of the forms: user@example.com
User <user@example.com>
'User' <user@example.com>
If strictValidation is false, then the domain portion of the email address is not required to contain a dot. 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 v1.0

FORMfields