A FormElement
represents a row in a FormContainer
. A FormElement
is a combination of one label and different controls associated to this label.
Constructor for a new sap.ui.layout.form.FormElement.
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.FormElement(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 |
Default Aggregation: fields
Name | Cardinality | Type | Description |
---|---|---|---|
_label | 0..1 | sap.ui.core.Label | |
fields (default) | 0..n | sap.ui.core.Control |
Form controls that belong together to be displayed in one row of a Warning: Do not put any layout or other container controls in here. This could damage the visual layout, keyboard support and screen-reader support. Only form controls are allowed. Views are also not supported. Allowed controls implement the interface |
label | 0..1 | sap.ui.core.Label |
Label of the fields. Can either be a |
Method | Description |
---|---|
_setEditable |
Sets the editable state of the This must only be called from the Labels inside of a |
addField |
Adds some field to the aggregation fields. |
destroyFields |
Destroys all the fields in the aggregation fields. |
destroyLabel |
Destroys the label in the aggregation label. |
sap.ui.layout.form.FormElement.extend |
Creates a new subclass of class sap.ui.layout.form.FormElement with name
|
getFields |
Gets content of aggregation fields. Form controls that belong together to be displayed in one row of a Warning: Do not put any layout or other container controls in here. This could damage the visual layout, keyboard support and screen-reader support. Only form controls are allowed. Views are also not supported. Allowed controls implement the interface |
getFieldsForRendering |
Determines what fields must be rendered. |
getLabel |
Gets content of aggregation label. Label of the fields. Can either be a |
getLabelControl |
Returns the |
sap.ui.layout.form.FormElement.getMetadata |
Returns a metadata object for class sap.ui.layout.form.FormElement. |
getVisible |
Gets current value of property visible. If set to Default value is |
indexOfField |
Checks for the provided |
insertField |
Inserts a field into the aggregation fields. |
invalidateLabel |
Labels inside of a Form must be invalidated if "editable" changed on Form |
isVisible |
Determines if the For rendering by |
removeAllFields |
Removes all the controls from the aggregation fields. Additionally, it unregisters them from the hosting UIArea. |
removeField |
Removes a field from the aggregation fields. |
setLabel |
Sets the aggregated label. |
setVisible |
Sets a new value for property visible. If set to When called with a value of Default value is |
Sets the editable state of the FormElement
.
This must only be called from the Form
and it's FormContainers
.
Labels inside of a Form
must be invalidated if editable
changed on Form
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bEditable | boolean |
Editable state of the |
Adds some field to the aggregation fields.
Param | Type | DefaultValue | Description |
---|---|---|---|
oField | sap.ui.core.Control |
The field to add; if empty, nothing is inserted |
Creates a new subclass of class sap.ui.layout.form.FormElement 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 |
Gets content of aggregation fields.
Form controls that belong together to be displayed in one row of a Form
.
Warning: Do not put any layout or other container controls in here. This could damage the visual layout, keyboard support and screen-reader support. Only form controls are allowed. Views are also not supported. Allowed controls implement the interface sap.ui.core.IFormContent
.
Gets content of aggregation label.
Label of the fields. Can either be a Label
control or a string. If a Label
control is used, the properties of the Label
can be set. If no assignment between Label
and the fields is set via (labelFor
property of the Label
), it will be done automatically by the FormElement
. In this case the Label
is assigned to the fields of the FormElement
.
Returns the Label
of the FormElement
, even if the Label
is assigned as string. The FormLayout
needs the information of the label to render the Form
.
Returns a metadata object for class sap.ui.layout.form.FormElement.
Gets current value of property visible.
If set to false
, the FormElement
is not rendered.
Default value is true
.
Checks for the provided sap.ui.core.Control
in the aggregation fields. and returns its index if found or -1 otherwise.
Param | Type | DefaultValue | Description |
---|---|---|---|
oField | sap.ui.core.Control |
The field whose index is looked for |
Inserts a field into the aggregation fields.
Param | Type | DefaultValue | Description |
---|---|---|---|
oField | sap.ui.core.Control |
The field to insert; if empty, nothing is inserted |
|
iIndex | int |
The |
Determines if the FormElement
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
.
Removes all the controls from the aggregation fields.
Additionally, it unregisters them from the hosting UIArea.
Removes a field from the aggregation fields.
Param | Type | DefaultValue | Description |
---|---|---|---|
vField | int string sap.ui.core.Control |
The field to remove or its index or id |
Sets the aggregated label.
Param | Type | DefaultValue | Description |
---|---|---|---|
vLabel | sap.ui.core.Label string |
The label to set |
Sets a new value for property visible.
If set to false
, the FormElement
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 |