/**
* The required files
*/
require_once(HTML_FORM_ELEMENTS_PAGE_PATH.'/ControlCommon.php');
/**
* Generates a a complete plug-n-play Password control
* for a form. Ready to use
* The validor must check for the following
* - Not empty, which means is required
* - in range, min,max number of characters
* <code>
* Usage:
* $label = new Label($text,$for,$accesskey,$class);
* $control = new Password($name,$value,$class,$size,$maxlength,$disabled,$readonly,$onclick,$title,$tabindex,$accesskey);
*
* $element = new ControlPassword($label,$control);
* print $element->getHtml();
* Or
* ControlPassword::display($label,$control);
* </code>
* @package form-elements
*/
class ControlPassword extends ControlCommon {
/**
* Constructor
* @param Label $label The Label object
* @param Password $control The Control object
*/
function ControlPassword($label='',$control='') {
$this->ControlCommon($label,$control);
}
/**
* Check the control if is valid data and updates the ValidatorErrorList
* <code>
* Usage:
* $element = new ControlPassword();
* $rc = $element->isValid();
* </code>
* @return boolean True if the data is valid else false
*/
function isValid() {
$this->isvalid &= $this->isRequired();
$this->isvalid &= $this->inRange();
return $this->isvalid;
}
/**
* Display html
* <code>
* Usage:
* $label = new Label($text,$for,$accesskey,$class);
* $control = new Password($name,$value,$class,$size,$maxlength,$disabled,$readonly,$onclick,$title,$tabindex,$accesskey);
* ControlPassword::display($label,$control);
* </code>
* @static
* @param Label $label The Label object
* @param Password $control The Password Control object
*/
function display($label='',$control='') {
$html = new ControlPassword($label,$control);
$html->addHtml();
}
}
?>
HTML source code
Den fulde HTML kildekode for ControlPassword klassen