/**
* The required files
*/
require_once(HTML_FORM_ELEMENTS_PAGE_PATH.'/ControlCommon.php');
/**
* Generates a complete plug-n-play Email control
* for a form. Ready to use
* The validor must check for the following
* - Not empty, which means is required
* - a valid email address x@y.z or url
* <code>
* Usage:
* $label = new Label($text,$for,$accesskey,$class);
* $control = new Text($name,$value,$class,$size,$maxlength,$disabled,$readonly,$onclick,$title,$tabindex,$accesskey);
*
* $element = new ControlEmail($label,$control);
* print $element->getHtml();
* Or
* ControlEmail::display($label,$control);
* </code>
* @package form-elements
*/
class ControlEmail extends ControlCommon {
/**
* Constructor
* @param Label $label The Label object
* @param Text $control The Text Control object
*/
function ControlEmail($label='',$control='') {
$this->ControlCommon($label,$control);
}
/**
* Check the control if is valid data and updates the ValidatorErrorList
* <code>
* Usage:
* $element = new ControlEmail();
* $rc = $element->isValid();
* </code>
* @return boolean True if the data is valid else false
*/
function isValid() {
$this->isvalid &= $this->isRequired();
$this->isvalid &= $this->isEmail();
return $this->isvalid;
}
/**
* Display html
* <code>
* Usage:
* $label = new Label($text,$for,$accesskey,$class);
* $control = new Text($name,$value,$class,$size,$maxlength,$disabled,$readonly,$onclick,$title,$tabindex,$accesskey);
* ControlEmail::display($label,$control);
* </code>
* @static
* @param Label $label The Label object
* @param Text $control The Control object
*/
function display($label='',$control='') {
$html = new ControlEmail($label,$control);
$html->addHtml();
}
}
?>