Source for file BaseWidgets.php
Documentation is available at BaseWidgets.php
* @copyright Copyright (c) 2006,2007 Mirchev Ideas Ltd. All rights reserved.
* Base class for the base widgets: text, checkbox, radio, select
* @copyright Copyright (c) 2006,2007 Mirchev Ideas Ltd. All rights reserved.
* @param string $fieldName the name of the field
* Retrieves the field name
* @return string the field name
* Use it with input type="text" and with textarea
* @copyright Copyright (c) 2006,2007 Mirchev Ideas Ltd. All rights reserved.
* Returns the text widget contents to be displayed
* Process the form submissions and returns the text widget data
* Validates the text widget
public function validateData(miWebFormErrorsHandler &$errors)
$errors->addError($this->_fieldName, 'Field too short');
$errors->addError($this->_fieldName, 'Field too long');
* Use it with input type="checkbox"
* @copyright Copyright (c) 2006,2007 Mirchev Ideas Ltd. All rights reserved.
public function __construct(miWebForm &$webForm, $properties =
array())
parent::__construct($webForm, $properties);
* Sets the default state of the checkbox
* @param boolean $defaultValue
* Returns the checkbox widget contents to be displayed
* Process the form submissions and returns the checkbox widget data
// The checkbox is checked if the value is non-empty string
* Use it with input type="radio"
* This class supports a group of radio buttons
* @copyright Copyright (c) 2006,2007 Mirchev Ideas Ltd. All rights reserved.
* Array with the radio buttons
* The index of the default radio button
* The $radioButtons is an associative array
* where the key is used to separate the radio buttons within a group and
* the value is the display value of the radio button
* If $defaultRadioIndex is not set the first radio button is checked.
* @param array $radioButtons
* @param string|int$defaultRadioIndex the index of the default radio button (optional)
// Make sure that the default index is valid
if ($defaultRadioIndex !==
null) {
if (empty($radioButtons[$defaultRadioIndex]))
// If we cannot find the $value in the radioButtons group use the default
* Returns the widget contents to be displayed
$display[$this->_fieldName .
'_' .
$key] =
($value ==
$key) ?
'checked="checked"' :
'';
* Process the form submissions and returns the widget data
* @copyright Copyright (c) 2006,2007 Mirchev Ideas Ltd. All rights reserved.
public function setOptions($options, $defaultOptionIndex =
null)
// Make sure the _defaultOptionIndex is valid or null
if ($defaultOptionIndex !==
null) {
if (empty($options[$defaultOptionIndex]))
* Returns the widget contents to be displayed
foreach ($this->_options as $key =>
$option)
* Process the form submissions and returns the widget data
Documentation generated on Thu, 08 May 2008 16:57:10 +0300 by phpDocumentor 1.4.1