/**
* The required files
*/
require_once(HTML_FORM_ELEMENTS_PAGE_PATH.'/ControlCommon.php');
/**
* Generates a a complete plug-n-play Accept conditions control
* for a form. Ready to use
* _
* | | Click here, to accept the conditions
* -
* The validor must check for the following
* - The user must click the checkbox
* <code>
* Usage:
* $label = new Label($text,$for,$accesskey,$class);
* $control = new Checkbox($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
*
* $element = new ControlAccept($label,$control);
* print $element->getHtml();
* Or
* ControlAccept::display($label,$control);
* </code>
* @package form-elements
*/
class ControlAccept extends ControlCommon {
/**
* Constructor
* @param Label $label The Label object
* @param Checkbox $control The Checkbox Control object
*/
function ControlAccept($label='',$control='') {
$this->ControlCommon($label,$control);
}
/**
* Check the control if is valid data and updates the ValidatorErrorList
* <code>
* Usage:
* $element = new ControlAccept();
* $rc = $element->isValid();
* </code>
* @return boolean True if the data is valid else false
*/
function isValid() {
$this->isvalid &= $this->isChecked();
return $this->isvalid;
}
/**
* Display html
* <code>
* Usage:
* $label = new Label($text,$for,$accesskey,$class);
* $control = new Checkbox($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
* ControlAccept::display($label,$control);
* </code>
* @static
* @param Label $label The Label object
* @param Checkbox $control The Control object
*/
function display($label='',$control='') {
$html = new ControlAccept($label,$control);
$html->addHtml();
}
}
?>
HTML source code
Den fulde HTML kildekode for ControlAccept klassen