HTML_QuickForm2
[ class tree: HTML_QuickForm2 ] [ index: HTML_QuickForm2 ] [ all elements ]

Class: HTML_QuickForm2_Rule_Email

Source Location: /HTML_QuickForm2-2.1.0/HTML/QuickForm2/Rule/Email.php

Class Overview

HTML_QuickForm2_Rule
   |
   --HTML_QuickForm2_Rule_Email

Validates email address


Author(s):

Version:

  • Release: 2.1.0

Methods


Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Rule

HTML_QuickForm2_Rule::__construct()
Class constructor
HTML_QuickForm2_Rule::and_()
Adds a rule to the chain with an "and" operator
HTML_QuickForm2_Rule::getConfig()
Returns the rule's configuration data
HTML_QuickForm2_Rule::getJavascript()
Returns the client-side representation of the Rule
HTML_QuickForm2_Rule::getJavascriptCallback()
Returns the client-side validation callback
HTML_QuickForm2_Rule::getJavascriptTriggers()
Returns IDs of form fields that should trigger "live" Javascript validation
HTML_QuickForm2_Rule::getMessage()
Returns the error message output by the rule
HTML_QuickForm2_Rule::getOwnJavascriptTriggers()
Returns IDs of form fields that should trigger "live" Javascript validation
HTML_QuickForm2_Rule::mergeConfig()
Merges local configuration with that provided for registerRule()
HTML_QuickForm2_Rule::or_()
Adds a rule to the chain with an "or" operator
HTML_QuickForm2_Rule::setConfig()
Sets configuration data for the rule
HTML_QuickForm2_Rule::setMessage()
Sets the error message output by the rule
HTML_QuickForm2_Rule::setOwner()
Sets the element that will be validated by this rule
HTML_QuickForm2_Rule::setOwnerError()
Sets the error message on the owner element
HTML_QuickForm2_Rule::validate()
Performs validation
HTML_QuickForm2_Rule::validateOwner()
Validates the owner element

Class Details

[line 61]
Validates email address

Email address format as defined in RFCs 822, 2822 and 5322 is quite complex and has many uncommon features. This rule was designed with registration forms in mind, where a user usually enters her email address in order to receive a newsletter or a confirmation. So it currently supports a most common subset of email address format, disallowing

  • domain literals like root@[127.0.0.1] or root@[IPv6:::]
  • quoted strings in local part "John Doe"@example.com
Support for these may be added in the future, until then you may consider using PHP filter_var() function with FILTER_VALIDATE_EMAIL. Note also that the characters "-", "_", "+", "!", "#", "$", "%", "&", "'", "*", "/", "=", "?", "^", "`", "{", "|", "}", "~" are valid in the local part of email address according to RFC, though most of these are highly improbable in any reallife address. We may add a means of limiting this list in the future, for now you may use the 'notregex' rule to disallow some of these if needed.

As recommended in the RFC, the local part must not be longer than 64 characters and the domain part 255. This means that the address can be up to 320 characters long. The number of subdomains is arbitrary limited to 10. You can use the maxlength rule in conjunction if you need to enforce shorter addresses. A length of 100 for the whole address is usually far enough.



[ Top ]


Method Detail

getJavascriptCallback   [line 103]

string getJavascriptCallback( )

Returns the client-side validation callback
  • Access: protected

Overrides HTML_QuickForm2_Rule::getJavascriptCallback() (Returns the client-side validation callback)
[ Top ]

validateOwner   [line 68]

bool validateOwner( )

Validates the owner element
  • Return: whether element's value is in a commonly used email address format
  • Access: protected

Overrides HTML_QuickForm2_Rule::validateOwner() (Validates the owner element)
[ Top ]


Documentation generated on Wed, 10 Apr 2019 08:56:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.