Source for file checkbox.php
Documentation is available at checkbox.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Adam Daniel <adaniel1@eesus.jnj.com> |
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
// $Id: checkbox.php,v 1.20 2005/07/22 17:30:51 avb Exp $
require_once("HTML/QuickForm/input.php");
* HTML class for a checkbox type field
* @author Adam Daniel <adaniel1@eesus.jnj.com>
* @author Bertrand Mansion <bmansion@mamasam.com>
* @param string $elementName (optional)Input field name attribute
* @param string $elementLabel (optional)Input field value
* @param string $text (optional)Checkbox display text
* @param mixed $attributes (optional)Either a typical HTML attribute string
* or an associative array
$this->_persistantFreeze = true;
$this->setType ('checkbox');
$this->updateAttributes (array ('value'=>1 ));
* Sets whether a checkbox is checked
* @param bool $checked Whether the field is checked or not
$this->removeAttribute ('checked');
$this->updateAttributes (array ('checked'=> 'checked'));
* Returns whether a checkbox is checked
return (bool) $this->getAttribute ('checked');
* Returns the checkbox element in HTML
if (0 == strlen($this->_text)) {
} elseif ($this->_flagFrozen) {
$label = '<label for="' . $this->getAttribute ('id') . '">' . $this->_text . '</label>';
* Returns the value of field without HTML tags
$this->_getPersistantData ();
} //end func getFrozenHtml
* Returns the checkbox text
* Sets the value of the form element
* @param string $value Default value of the form element
* Returns the value of the form element
// {{{ onQuickFormEvent()
* Called by HTML_QuickForm whenever form event is made on this element
* @param string $event Name of event
* @param mixed $arg event arguments
* @param object $caller calling object
// constant values override both default and submitted ones
// default values are overriden by submitted
$value = $this->_findValue ($caller->_constantValues );
// if no boxes were checked, then there is no value in the array
// yet we don't want to display default value in this case
if ($caller->isSubmitted ()) {
$value = $this->_findValue ($caller->_submitValues );
$value = $this->_findValue ($caller->_defaultValues );
parent ::onQuickFormEvent ($event, $arg, $caller);
} // end func onQuickFormEvent
* Return true if the checkbox is checked, null if it is not checked (getValue() returns false)
$value = $this->_findValue ($submitValues);
return $this->_prepareValue ($value, $assoc);
} //end class HTML_QuickForm_checkbox
Documentation generated on Mon, 11 Mar 2019 14:16:31 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|