Creates a form using tab-layout where each tab is a subform

package Gems
subpackage Form
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
inherited_from \Gems_Form

 Methods

Constructor

__construct(mixed $options = null

Registers form view helper as decorator

inherited_from \Gems_Form::__construct()

Parameters

$options

Constructor

__construct(mixed $options = null) : void
Inherited

Registers form view helper as decorator

Parameters

$options

mixed

activateBootstrap()

activateBootstrap() 
Inherited

Activate JQuery for this form

activateJQuery() : \MUtil_Form
Inherited

Returns

\MUtil_Form(continuation pattern)

Add an element to the form, when a tab (subform) had been added, it will return the subform instead of the form, keep this in mind when chaining methods

addDisplayGroup(array $elements, string $name, array|\Zend_Config $options = null) : \Gems_TabForm | \Gems_Form_TabSubForm

Parameters

$elements

array

$name

string

$options

array\Zend_Config

Exceptions

\Zend_Form_Exception if no valid elements provided

Returns

\Gems_TabForm\Gems_Form_TabSubForm

Add an element to the form, when a tab (subform) had been added, it will return the subform instead of the form, keep this in mind when chaining methods

addElement(string|\Zend_Form_Element $element, string $name = null, array|\Zend_Config $options = null) : \Gems_TabForm | \Gems_Form_TabSubForm

$element may be either a string element type, or an object of type \Zend_Form_Element. If a string element type is provided, $name must be provided, and $options may be optionally provided for configuring the element.

If a \Zend_Form_Element is provided, $name may be optionally provided, and any provided $options will be ignored.

inherited_from \Gems_Form::addElement()

Parameters

$element

string\Zend_Form_Element

$name

string

$options

array\Zend_Config

Exceptions

\Zend_Form_Exception on invalid element

Returns

\Gems_TabForm\Gems_Form_TabSubForm

Add a new element

addElement(string|\Zend_Form_Element $element, string $name = null, array|\Zend_Config $options = null) : \Zend_Form
Inherited

$element may be either a string element type, or an object of type \Zend_Form_Element. If a string element type is provided, $name must be provided, and $options may be optionally provided for configuring the element.

If a \Zend_Form_Element is provided, $name may be optionally provided, and any provided $options will be ignored.

Parameters

$element

string\Zend_Form_Element

$name

string

$options

array\Zend_Config

Exceptions

\Zend_Form_Exception on invalid element

Returns

\Zend_Form(continuation pattern)

Add a tab to the form

addTab(string $name, string $title) : \Gems_Form_TabSubForm

Parameters

$name

string

$title

string

Returns

\Gems_Form_TabSubForm

Add to the group all non-tab elements are in

addToOtherGroup(mixed $element) : \Gems_TabForm

Parameters

$element

mixed

Returns

\Gems_TabForm

Get the autosubmit arguments (if any)

getAutoSubmit() : array
Inherited

Returns

arrayor null

Return a display group, use recursive search in subforms to provide a transparent experience with tabs

getDisplayGroup(string $name) : \Zend_Form_DisplayGroup | null

Parameters

$name

string

Returns

\Zend_Form_DisplayGroupnull

Retrieve a single element, use recursive search in subforms to provide a transparent experience with tabs

getElement(string $name) : \Zend_Form_Element | null

Parameters

$name

string

Returns

\Zend_Form_Elementnull

Retrieve a named tab (subform) and set the active tab to this one

getTab(string $name) : \Gems_Form_TabSubForm

Parameters

$name

string

Returns

\Gems_Form_TabSubForm

Retrieve all form element values

getValues(boolean $suppressArrayNotation = false) : array

Fix for ZF error where subform values will be pushed into an array with key: formname for compatibility both are now in the result array

Parameters

$suppressArrayNotation

boolean

Returns

array

Is this a form that autosubmits?

isAutoSubmit() : boolean
Inherited

Returns

boolean

Load the default decorators

loadDefaultDecorators() : void

Reset the currentTab to be the main form again

resetContext() 

As addElement and addDisplayGroup provide a fluent way of working with subforms we need to provide a method to skip back to the main form again.

Select a tab by it's numerical index

selectTab(integer $tabIdx) 

Parameters

$tabIdx

integer

Change the form into an autosubmit form

setAutoSubmit(mixed $submitUrl, mixed $targetId, $selective = false
Inherited

Parameters

$submitUrl

mixed

Url as \MUtil_Html_UrlArrayAttribute, array or string

$targetId

mixed

Id of html element whose content is replaced by the submit result: \MUtil_Html_ElementInterface or string

$selective

Set the form to be verbose, showing above the form what tabs have errors and possibly add custom (sub)formlevel error messages

setVerbose(boolean $bool) 

Parameters

$bool

boolean

Set the view object

setView(\Zend_View_Interface $view = null) : \Gems_TabForm

Parameters

$view

\Zend_View_Interface

Returns

\Gems_TabForm

_activateJQueryView()

_activateJQueryView(\Zend_View_Interface $view = null
Inherited

Parameters

$view

Change all elements into an autosubmit element

_enableAutoSubmitElement(mixed $element) 
Inherited

Call only when $_autoSubmit is set

Parameters

$element

mixed

 Properties

 

If set this holds the url and targetid for the autosubmit

$_autosubmit : array

Default

null
 

Holds the last tab we added information to

$currentTab : \Gems_Form_TabSubForm

Default

null

 Constants

 

Group ID for elements below form

GROUP_OTHER = 'not_in_tab'