class Container extends Container implements ArrayAccess

Container for form controls.

Properties

callable[] $onValidate
protected ControlGroup $currentGroup
ArrayHash $values
ArrayIterator read-only $controls
Form read-only $form

Methods

setDefaults($values, $erase = FALSE)

Fill-in with default values.

setValues($values, $erase = FALSE)

Fill-in with values.

ArrayHash|array
getValues($asArray = FALSE)

Returns the values submitted by the form.

bool
isValid()

Is form valid?

void
validate(array $controls = NULL)

Performs the server side validation.

array
getErrors()

Returns all validation errors.

setCurrentGroup(ControlGroup $group = NULL)

No description

getCurrentGroup()

Returns current group.

addComponent(IComponent $component, $name, $insertBefore = NULL)

Adds the specified component to the IContainer.

getControls()

Iterates over all form controls.

getForm($need = TRUE)

Returns form.

addText($name, $label = NULL, $cols = NULL, $maxLength = NULL)

Adds single-line text input control to the form.

addPassword($name, $label = NULL, $cols = NULL, $maxLength = NULL)

Adds single-line text input control used for sensitive input such as passwords.

addTextArea($name, $label = NULL, $cols = NULL, $rows = NULL)

Adds multi-line text input control to the form.

addUpload($name, $label = NULL, $multiple = FALSE)

Adds control that allows the user to upload files.

addMultiUpload($name, $label = NULL)

Adds control that allows the user to upload multiple files.

addHidden($name, $default = NULL)

Adds hidden form control used to store a non-displayed value.

addCheckbox($name, $caption = NULL)

Adds check box control to the form.

addRadioList($name, $label = NULL, array $items = NULL)

Adds set of radio button controls to the form.

addCheckboxList($name, $label = NULL, array $items = NULL)

Adds set of checkbox controls to the form.

addSelect($name, $label = NULL, array $items = NULL, $size = NULL)

Adds select box control that allows single item selection.

addMultiSelect($name, $label = NULL, array $items = NULL, $size = NULL)

Adds select box control that allows multiple item selection.

addSubmit($name, $caption = NULL)

Adds button used to submit form.

addButton($name, $caption = NULL)

Adds push buttons with no default behavior.

addImage($name, $src = NULL, $alt = NULL)

Adds graphical button used to submit form.

addContainer($name)

Adds naming container to the form.

void
offsetSet($name, $component)

Adds the component to the container.

IComponent
offsetGet($name)

Returns component specified by name. Throws exception if component doesn't exist.

bool
offsetExists($name)

Does component specified by name exists?

void
offsetUnset($name)

Removes component from the container.

__clone()

Prevents cloning.

Details

at line 41
Container setDefaults($values, $erase = FALSE)

Fill-in with default values.

Parameters

$values
$erase

Return Value

Container

at line 58
Container setValues($values, $erase = FALSE)

internal  
 

Fill-in with values.

Parameters

$values
$erase

Return Value

Container

at line 94
ArrayHash|array getValues($asArray = FALSE)

Returns the values submitted by the form.

Parameters

$asArray

Return Value

ArrayHash|array

at line 116
bool isValid()

Is form valid?

Return Value

bool

at line 133
void validate(array $controls = NULL)

Performs the server side validation.

Parameters

array $controls

Return Value

void

at line 158
array getErrors()

Returns all validation errors.

Return Value

array

at line 174
Container setCurrentGroup(ControlGroup $group = NULL)

No description

Parameters

ControlGroup $group

Return Value

Container

at line 185
ControlGroup getCurrentGroup()

Returns current group.

Return Value

ControlGroup

at line 199
Container addComponent(IComponent $component, $name, $insertBefore = NULL)

Adds the specified component to the IContainer.

Parameters

IComponent $component
$name
$insertBefore

Return Value

Container

Exceptions

InvalidStateException

at line 213
ArrayIterator getControls()

Iterates over all form controls.

Return Value

ArrayIterator

at line 224
Form getForm($need = TRUE)

Returns form.

Parameters

$need

Return Value

Form

at line 241
TextInput addText($name, $label = NULL, $cols = NULL, $maxLength = NULL)

Adds single-line text input control to the form.

Parameters

$name
$label
$cols
$maxLength

Return Value

TextInput

at line 257
TextInput addPassword($name, $label = NULL, $cols = NULL, $maxLength = NULL)

Adds single-line text input control used for sensitive input such as passwords.

Parameters

$name
$label
$cols
$maxLength

Return Value

TextInput

at line 273
TextArea addTextArea($name, $label = NULL, $cols = NULL, $rows = NULL)

Adds multi-line text input control to the form.

Parameters

$name
$label
$cols
$rows

Return Value

TextArea

at line 288
UploadControl addUpload($name, $label = NULL, $multiple = FALSE)

Adds control that allows the user to upload files.

Parameters

$name
$label
$multiple

Return Value

UploadControl

at line 300
UploadControl addMultiUpload($name, $label = NULL)

Adds control that allows the user to upload multiple files.

Parameters

$name
$label

Return Value

UploadControl

at line 312
HiddenField addHidden($name, $default = NULL)

Adds hidden form control used to store a non-displayed value.

Parameters

$name
$default

Return Value

HiddenField

at line 326
Checkbox addCheckbox($name, $caption = NULL)

Adds check box control to the form.

Parameters

$name
$caption

Return Value

Checkbox

at line 339
RadioList addRadioList($name, $label = NULL, array $items = NULL)

Adds set of radio button controls to the form.

Parameters

$name
$label
array $items

Return Value

RadioList

at line 349
CheckboxList addCheckboxList($name, $label = NULL, array $items = NULL)

Adds set of checkbox controls to the form.

Parameters

$name
$label
array $items

Return Value

CheckboxList

at line 363
SelectBox addSelect($name, $label = NULL, array $items = NULL, $size = NULL)

Adds select box control that allows single item selection.

Parameters

$name
$label
array $items
$size

Return Value

SelectBox

at line 381
MultiSelectBox addMultiSelect($name, $label = NULL, array $items = NULL, $size = NULL)

Adds select box control that allows multiple item selection.

Parameters

$name
$label
array $items
$size

Return Value

MultiSelectBox

at line 397
SubmitButton addSubmit($name, $caption = NULL)

Adds button used to submit form.

Parameters

$name
$caption

Return Value

SubmitButton

at line 409
Button addButton($name, $caption = NULL)

Adds push buttons with no default behavior.

Parameters

$name
$caption

Return Value

Button

at line 422
ImageButton addImage($name, $src = NULL, $alt = NULL)

Adds graphical button used to submit form.

Parameters

$name
$src
$alt

Return Value

ImageButton

at line 433
Container addContainer($name)

Adds naming container to the form.

Parameters

$name

Return Value

Container

at line 450
void offsetSet($name, $component)

Adds the component to the container.

Parameters

$name
$component

Return Value

void

at line 462
IComponent offsetGet($name)

Returns component specified by name. Throws exception if component doesn't exist.

Parameters

$name

Return Value

IComponent

Exceptions

InvalidArgumentException

at line 473
bool offsetExists($name)

Does component specified by name exists?

Parameters

$name

Return Value

bool

at line 484
void offsetUnset($name)

Removes component from the container.

Parameters

$name

Return Value

void

at line 496
__clone()

Prevents cloning.