|
Moodle
2.2.1
http://www.collinsharper.com
|


Public Member Functions | |
| HTML_QuickForm_advcheckbox ($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) | |
| getPrivateName ($elementName) | |
| getOnclickJs ($elementName) | |
| setValues ($values) | |
| setValue ($value) | |
| getValue () | |
| toHtml () | |
| getFrozenHtml () | |
| onQuickFormEvent ($event, $arg, &$caller) | |
| exportValue (&$submitValues, $assoc) | |
Data Fields | |
| $_values = null | |
| $_currentValue = null | |
HTML class for an advanced checkbox type field
Basically this fixes a problem that HTML has had where checkboxes can only pass a single value (the value of the checkbox when checked). A value for when the checkbox is not checked cannot be passed, and furthermore the checkbox variable doesn't even exist if the checkbox was submitted unchecked.
It works by prepending a hidden field with the same name and another "unchecked" value to the checbox. If the checkbox is checked, PHP overwrites the value of the hidden field with its value.
Definition at line 43 of file advcheckbox.php.
| exportValue | ( | &$ | submitValues, |
| $ | assoc | ||
| ) |
This element has a value even if it is not checked, thus we override checkbox's behaviour here
Reimplemented from HTML_QuickForm_checkbox.
Definition at line 265 of file advcheckbox.php.
| getFrozenHtml | ( | ) |
Unlike checkbox, this has to append a hidden input in both checked and non-checked states
Reimplemented from HTML_QuickForm_checkbox.
Reimplemented in MoodleQuickForm_advcheckbox.
Definition at line 216 of file advcheckbox.php.
| getOnclickJs | ( | $ | elementName | ) |
Create the javascript for the onclick event which will set the value of the hidden field
| string | $elementName | The element name |
public
Definition at line 118 of file advcheckbox.php.
| getPrivateName | ( | $ | elementName | ) |
Gets the private name for the element
| string | $elementName | The element name to make private |
public
Definition at line 99 of file advcheckbox.php.
| getValue | ( | ) |
Returns the element's value
public
Reimplemented from HTML_QuickForm_checkbox.
Definition at line 176 of file advcheckbox.php.
| HTML_QuickForm_advcheckbox | ( | $ | elementName = null, |
| $ | elementLabel = null, |
||
| $ | text = null, |
||
| $ | attributes = null, |
||
| $ | values = null |
||
| ) |
Class constructor
| string | $elementName | (optional)Input field name attribute |
| string | $elementLabel | (optional)Input field label |
| string | $text | (optional)Text to put after the checkbox |
| mixed | $attributes | (optional)Either a typical HTML attribute string or an associative array |
| mixed | $values | (optional)Values to pass if checked or not checked |
Definition at line 80 of file advcheckbox.php.


| onQuickFormEvent | ( | $ | event, |
| $ | arg, | ||
| &$ | caller | ||
| ) |
Called by HTML_QuickForm whenever form event is made on this element
| string | $event | Name of event |
| mixed | $arg | event arguments |
| object | $caller | calling object |
Reimplemented from HTML_QuickForm_checkbox.
Definition at line 235 of file advcheckbox.php.
| setValue | ( | $ | value | ) |
Sets the element's value
| mixed | Element's value public |
Reimplemented from HTML_QuickForm_checkbox.
Definition at line 161 of file advcheckbox.php.
| setValues | ( | $ | values | ) |
Sets the values used by the hidden element
| mixed | $values | The values, either a string or an array |
public
Definition at line 136 of file advcheckbox.php.

| toHtml | ( | ) |
Returns the checkbox element in HTML and the additional hidden element in HTML
public
Reimplemented from HTML_QuickForm_checkbox.
Reimplemented in MoodleQuickForm_advcheckbox.
Definition at line 195 of file advcheckbox.php.
| $_currentValue = null |
Definition at line 61 of file advcheckbox.php.
| $_values = null |
Definition at line 53 of file advcheckbox.php.