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 43
Container setDefaults($values, $erase = FALSE)

Fill-in with default values.

Parameters

$values
$erase

Return Value

Container

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

Fill-in with values.

Parameters

$values
$erase

Return Value

Container

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

Returns the values submitted by the form.

Parameters

$asArray

Return Value

ArrayHash|array

at line 117
bool isValid()

Is form valid?

Return Value

bool

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

Performs the server side validation.

Parameters

array $controls

Return Value

void

at line 148
array getErrors()

Returns all validation errors.

Return Value

array

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

No description

Parameters

ControlGroup $group

Return Value

Container

at line 175
ControlGroup getCurrentGroup()

Returns current group.

Return Value

ControlGroup

at line 189
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 203
ArrayIterator getControls()

Iterates over all form controls.

Return Value

ArrayIterator

at line 214
Form getForm($need = TRUE)

Returns form.

Parameters

$need

Return Value

Form

at line 231
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 247
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 263
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 278
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 290
UploadControl addMultiUpload($name, $label = NULL)

Adds control that allows the user to upload multiple files.

Parameters

$name
$label

Return Value

UploadControl

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

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

Parameters

$name
$default

Return Value

HiddenField

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

Adds check box control to the form.

Parameters

$name
$caption

Return Value

Checkbox

at line 329
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 339
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 353
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 371
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 387
SubmitButton addSubmit($name, $caption = NULL)

Adds button used to submit form.

Parameters

$name
$caption

Return Value

SubmitButton

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

Adds push buttons with no default behavior.

Parameters

$name
$caption

Return Value

Button

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

Adds graphical button used to submit form.

Parameters

$name
$src
$alt

Return Value

ImageButton

at line 423
Container addContainer($name)

Adds naming container to the form.

Parameters

$name

Return Value

Container

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

Adds the component to the container.

Parameters

$name
$component

Return Value

void

at line 452
IComponent offsetGet($name)

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

Parameters

$name

Return Value

IComponent

Exceptions

InvalidArgumentException

at line 463
bool offsetExists($name)

Does component specified by name exists?

Parameters

$name

Return Value

bool

at line 474
void offsetUnset($name)

Removes component from the container.

Parameters

$name

Return Value

void

at line 486
__clone()

Prevents cloning.