AnewtFormControlCheckbox Class Reference

Form control for a single checkbox. More...

List of all members.

Public Member Functions

 __construct ($name)
 Create a new AnewtFormControlCheckbox instance.
 fill ($values)
 Fill the form control from the given values.
 build_widget ()
 Render the minimal HTML needed for this control to work.


Detailed Description

Form control for a single checkbox.

This control renders a HTML input element. Checkboxes have two labels, label and secondary-label, both of which may be set (both optional). Form renderers should render the label value just like labels for other controls are rendered. The secondary-label (if set) will be shown right next to the checkbox itself.

If you want multiple consecutive AnewtFormControlCheckbox controls to have the user check zero or more items, consider using AnewtFormControlChoice with the multiple property enabled instead.

Note that for yes/no-like questions you may also use AnewtFormControlChoice with just two options (and make sure it renders as two radio buttons; this is the default if you have just 2 options).

Definition at line 28 of file choice.lib.php.


Constructor & Destructor Documentation

AnewtFormControlCheckbox::__construct ( name  ) 

Create a new AnewtFormControlCheckbox instance.

Parameters:
$name The name of this control.

Reimplemented from AnewtFormControl.

Definition at line 36 of file choice.lib.php.


Member Function Documentation

AnewtFormControlCheckbox::fill ( values  ) 

Fill the form control from the given values.

This only sets the value for controls for which the can-be-filled property is enabled.

The return value of this function indicates whether the control was successfully filled with a value. For some control types such as checkboxes this always succeeds since both presence and absence of the value from $values are meaningful. For other controls such as text inputs this is only true if the value was actually present in the $values parameters.

Parameters:
$values An associative array from which the form control should be filled.
Returns:
true if filling was succesfull, false otherwise.
See also:
AnewtForm::fill()

Reimplemented from AnewtFormControl.

Definition at line 44 of file choice.lib.php.

AnewtFormControlCheckbox::build_widget (  ) 

Render the minimal HTML needed for this control to work.

Form control implementations should implement this method, e.g. for a checkbox a simple input HTML element should be returned.

Returns:
XHTML element with the minimal HTML markup needed for this control to function properly.

Reimplemented from AnewtFormControl.

Definition at line 57 of file choice.lib.php.


The documentation for this class was generated from the following file:

Generated on Sun Aug 2 22:54:37 2009 for Anewt by  doxygen 1.5.9