class Container extends Container implements ArrayAccess

Container for form controls.

Properties

callable[] $onValidate
protected ControlGroup|null $currentGroup
ArrayHash $values
Iterator read-only $controls
Form|null 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.

Form|null
getForm($throw = 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.

addEmail($name, $label = null)

Adds input for email.

addInteger($name, $label = null)

Adds input for integer.

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.

__call($name, $args)

No description

static 
extensionMethod($name, $callback = null)

No description

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 160
array getErrors()

Returns all validation errors.

Return Value

array

at line 176
Container setCurrentGroup(ControlGroup $group = null)

No description

Parameters

ControlGroup $group

Return Value

Container

at line 187
ControlGroup|null getCurrentGroup()

Returns current group.

Return Value

ControlGroup|null

at line 201
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 215
Iterator getControls()

Iterates over all form controls.

Return Value

Iterator

at line 226
Form|null getForm($throw = true)

Returns form.

Parameters

$throw

Return Value

Form|null

at line 243
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 258
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 274
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 287
TextInput addEmail($name, $label = null)

Adds input for email.

Parameters

$name
$label

Return Value

TextInput

at line 301
TextInput addInteger($name, $label = null)

Adds input for integer.

Parameters

$name
$label

Return Value

TextInput

at line 317
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 329
UploadControl addMultiUpload($name, $label = null)

Adds control that allows the user to upload multiple files.

Parameters

$name
$label

Return Value

UploadControl

at line 341
HiddenField addHidden($name, $default = null)

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

Parameters

$name
$default

Return Value

HiddenField

at line 354
Checkbox addCheckbox($name, $caption = null)

Adds check box control to the form.

Parameters

$name
$caption

Return Value

Checkbox

at line 366
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 378
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 392
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 407
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 420
SubmitButton addSubmit($name, $caption = null)

Adds button used to submit form.

Parameters

$name
$caption

Return Value

SubmitButton

at line 432
Button addButton($name, $caption = null)

Adds push buttons with no default behavior.

Parameters

$name
$caption

Return Value

Button

at line 445
ImageButton addImage($name, $src = null, $alt = null)

Adds graphical button used to submit form.

Parameters

$name
$src
$alt

Return Value

ImageButton

at line 456
Container addContainer($name)

Adds naming container to the form.

Parameters

$name

Return Value

Container

at line 470
__call($name, $args)

No description

Parameters

$name
$args

at line 479
static extensionMethod($name, $callback = null)

No description

Parameters

$name
$callback

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

Adds the component to the container.

Parameters

$name
$component

Return Value

void

at line 509
IComponent offsetGet($name)

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

Parameters

$name

Return Value

IComponent

Exceptions

InvalidArgumentException

at line 520
bool offsetExists($name)

Does component specified by name exists?

Parameters

$name

Return Value

bool

at line 531
void offsetUnset($name)

Removes component from the container.

Parameters

$name

Return Value

void

at line 543
__clone()

Prevents cloning.