class sap.ui.layout.form.FormContainer

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/layout/form/FormContainer
Application Component: CA-UI5-CMP

A FormContainer represents a group inside a Form. It consists of FormElements. The rendering of the FormContainer is done by the FormLayout assigned to the Form.


Constructor

Constructor for a new sap.ui.layout.form.FormContainer.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.layout.form.FormContainer(sId?, mSettings?)
Param Type Default Value Description
sId? string

ID for the new control, generated automatically if no ID is given

mSettings? object

Initial settings for the new control


Properties

Name Type Default Value Description
_editable boolean false

Internal property for the editable state of the internal FormContainer.

Visibility: hidden
expandable boolean false

Defines if the FormContainer is expandable.

Note: The expander icon will only be shown if a title is set for the FormContainer.

Visibility: public
expanded boolean true

Container is expanded.

Note: This property only works if expandable is set to true.

Visibility: public
visible boolean true

If set to false, the FormContainer is not rendered.

Visibility: public

Aggregations

Default Aggregation: formElements

Name Cardinality Type Description
_expandButton 0..1 sap.ui.core.Control
formElements (default) 0..n sap.ui.layout.form.FormElement

The FormElements contain the content (labels and fields) of the FormContainers.

title 0..1 sap.ui.core.Title

Title of the FormContainer. Can either be a Title element or a string. If a Title element is used, the style of the title can be set.

Note: If a Toolbar is used, the Title is ignored.

Note: If the title is provided as a string, the title is rendered with a theme-dependent default level. As the Form control cannot know the structure of the page, this might not fit the page structure. In this case provide the title using a Title element and set its level to the needed value.

toolbar 0..1 sap.ui.core.Toolbar

Toolbar of the FormContainer.

Note: If a Toolbar is used, the Title is ignored. If a title is needed inside the Toolbar it must be added at content to the Toolbar. In this case add the Title to the ariaLabelledBy association. Use the right title level to meet the visual requirements. This might be theme-dependent.

Since: 1.36.0.


Associations

Name Cardinality Type Description
ariaLabelledBy 0..n sap.ui.core.Control

Association to controls / IDs that label this control (see WAI-ARIA attribute aria-labelledby).

Note: This attribute is only rendered if the FormContainer has it's own DOM representation in the used FormLayout.

Since: 1.36.0.


Methods Overview

Method Description
_setEditable

Sets the editable state of the FormContainer.

This must only be called from the Form.

Labels inside of a Form must be invalidated if editable changed on Form.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

addFormElement

Adds some formElement to the aggregation formElements.

destroyFormElements

Destroys all the formElements in the aggregation formElements.

destroyTitle

Destroys the title in the aggregation title.

destroyToolbar

Destroys the toolbar in the aggregation toolbar.

sap.ui.layout.form.FormContainer.extend

Creates a new subclass of class sap.ui.layout.form.FormContainer with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Element.extend.

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getExpandable

Gets current value of property expandable.

Defines if the FormContainer is expandable.

Note: The expander icon will only be shown if a title is set for the FormContainer.

Default value is false.

getExpanded

Gets current value of property expanded.

Container is expanded.

Note: This property only works if expandable is set to true.

Default value is true.

getFormElements

Gets content of aggregation formElements.

The FormElements contain the content (labels and fields) of the FormContainers.

sap.ui.layout.form.FormContainer.getMetadata

Returns a metadata object for class sap.ui.layout.form.FormContainer.

getTitle

Gets content of aggregation title.

Title of the FormContainer. Can either be a Title element or a string. If a Title element is used, the style of the title can be set.

Note: If a Toolbar is used, the Title is ignored.

Note: If the title is provided as a string, the title is rendered with a theme-dependent default level. As the Form control cannot know the structure of the page, this might not fit the page structure. In this case provide the title using a Title element and set its level to the needed value.

getToolbar

Gets content of aggregation toolbar.

Toolbar of the FormContainer.

Note: If a Toolbar is used, the Title is ignored. If a title is needed inside the Toolbar it must be added at content to the Toolbar. In this case add the Title to the ariaLabelledBy association. Use the right title level to meet the visual requirements. This might be theme-dependent.

getVisible

Gets current value of property visible.

If set to false, the FormContainer is not rendered.

Default value is true.

indexOfFormElement

Checks for the provided sap.ui.layout.form.FormElement in the aggregation formElements. and returns its index if found or -1 otherwise.

insertFormElement

Inserts a formElement into the aggregation formElements.

isVisible

Determines if the FormContainer is visible or not. Per default it just returns the value of the visible property. But this might be overwritten by inherited elements.

For rendering by FormLayouts this function has to be used instead of getVisible.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllFormElements

Removes all the controls from the aggregation formElements.

Additionally, it unregisters them from the hosting UIArea.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

removeFormElement

Removes a formElement from the aggregation formElements.

setExpandable

Sets a new value for property expandable.

Defines if the FormContainer is expandable.

Note: The expander icon will only be shown if a title is set for the FormContainer.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

setExpanded

Sets a new value for property expanded.

Container is expanded.

Note: This property only works if expandable is set to true.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

setTitle

Sets the aggregated title.

setToolbar

Sets the aggregated toolbar.

setVisible

Sets a new value for property visible.

If set to false, the FormContainer is not rendered.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

_setEditable

Sets the editable state of the FormContainer.

This must only be called from the Form.

Labels inside of a Form must be invalidated if editable changed on Form.

Param Type DefaultValue Description
bEditable boolean

Editable state of the Form

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to add; if empty, nothing is inserted

addFormElement

Adds some formElement to the aggregation formElements.

Param Type DefaultValue Description
oFormElement sap.ui.layout.form.FormElement

The formElement to add; if empty, nothing is inserted

destroyFormElements

Destroys all the formElements in the aggregation formElements.

destroyTitle

Destroys the title in the aggregation title.

destroyToolbar

Destroys the toolbar in the aggregation toolbar.

sap.ui.layout.form.FormContainer.extend

Creates a new subclass of class sap.ui.layout.form.FormContainer with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Element.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getExpandable

Gets current value of property expandable.

Defines if the FormContainer is expandable.

Note: The expander icon will only be shown if a title is set for the FormContainer.

Default value is false.

getExpanded

Gets current value of property expanded.

Container is expanded.

Note: This property only works if expandable is set to true.

Default value is true.

getFormElements

Gets content of aggregation formElements.

The FormElements contain the content (labels and fields) of the FormContainers.

sap.ui.layout.form.FormContainer.getMetadata

Returns a metadata object for class sap.ui.layout.form.FormContainer.

getTitle

Gets content of aggregation title.

Title of the FormContainer. Can either be a Title element or a string. If a Title element is used, the style of the title can be set.

Note: If a Toolbar is used, the Title is ignored.

Note: If the title is provided as a string, the title is rendered with a theme-dependent default level. As the Form control cannot know the structure of the page, this might not fit the page structure. In this case provide the title using a Title element and set its level to the needed value.

getToolbar

Gets content of aggregation toolbar.

Toolbar of the FormContainer.

Note: If a Toolbar is used, the Title is ignored. If a title is needed inside the Toolbar it must be added at content to the Toolbar. In this case add the Title to the ariaLabelledBy association. Use the right title level to meet the visual requirements. This might be theme-dependent.

getVisible

Gets current value of property visible.

If set to false, the FormContainer is not rendered.

Default value is true.

indexOfFormElement

Checks for the provided sap.ui.layout.form.FormElement in the aggregation formElements. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oFormElement sap.ui.layout.form.FormElement

The formElement whose index is looked for

insertFormElement

Inserts a formElement into the aggregation formElements.

Param Type DefaultValue Description
oFormElement sap.ui.layout.form.FormElement

The formElement to insert; if empty, nothing is inserted

iIndex int

The 0-based index the formElement should be inserted at; for a negative value of iIndex, the formElement is inserted at position 0; for a value greater than the current size of the aggregation, the formElement is inserted at the last position

isVisible

Determines if the FormContainer is visible or not. Per default it just returns the value of the visible property. But this might be overwritten by inherited elements.

For rendering by FormLayouts this function has to be used instead of getVisible.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllFormElements

Removes all the controls from the aggregation formElements.

Additionally, it unregisters them from the hosting UIArea.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy int sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to be removed or its index or ID

removeFormElement

Removes a formElement from the aggregation formElements.

Param Type DefaultValue Description
vFormElement int string sap.ui.layout.form.FormElement

The formElement to remove or its index or id

setExpandable

Sets a new value for property expandable.

Defines if the FormContainer is expandable.

Note: The expander icon will only be shown if a title is set for the FormContainer.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Param Type DefaultValue Description
bExpandable boolean false

New value for property expandable

setExpanded

Sets a new value for property expanded.

Container is expanded.

Note: This property only works if expandable is set to true.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bExpanded boolean true

New value for property expanded

setTitle

Sets the aggregated title.

Param Type DefaultValue Description
vTitle sap.ui.core.Title string

The title to set

setToolbar

Sets the aggregated toolbar.

Param Type DefaultValue Description
oToolbar sap.ui.core.Toolbar

The toolbar to set

setVisible

Sets a new value for property visible.

If set to false, the FormContainer is not rendered.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bVisible boolean true

New value for property visible