new FormField(params)
Creates a new instance of the FormField class.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | The parameters for initializing the FormField. Properties
|
Methods
-
setId(id)
-
Sets the ID of the form field.
Parameters:
Name Type Description idstring The ID to set for the form field.
-
setParent(parentView)
-
Sets the parent view of the form field.
Parameters:
Name Type Description parentViewobject The parent view to set for the form field.
-
setInstanceManager(instanceManager)
-
Sets the instance manager for the form field.
Parameters:
Name Type Description instanceManagerobject The instance manager to set for the form field.
-
setActive()
-
Sets the form field as active.
-
setInactive()
-
Sets the form field as inactive.
-
isActive()
-
Checks if the form field is active.
Returns:
True if the form field is active, false otherwise.
- Type
- boolean
-
getFormContainerPath()
-
Returns the form container path of the form field.
Returns:
The form container path.
- Type
- string
-
getId()
-
Returns the ID of the form field.
Returns:
The form field ID.
- Type
- string
-
setModel(model)
-
Sets the model for the form field.
Parameters:
Name Type Description modelobject The model to set for the form field.
Throws:
-
Throws an error if the model is already initialized.
- Type
- string
-
-
syncMarkupWithModel()
-
Updates the HTML with the respective model. This is for the markup that is generated on the client-side (e.g., repeatable panel).
Throws:
-
Throws an error if the method is not implemented.
- Type
- string
-
-
toggle(property, dataAttribute, value)
-
Toggles the HTML element based on the property. If the property is false, then adds the data-attribute and CSS class.
Parameters:
Name Type Description propertyboolean The property to toggle.
dataAttributestring The data attribute to set or remove.
valuestring The value to set for the data attribute.
-
toggleAttribute(element, property, dataAttribute, value)
-
Toggles the given element based on the property. If the property is false, then adds the data-attribute and CSS class.
Parameters:
Name Type Description elementHTMLElement The element to toggle.
propertyboolean The property to toggle.
dataAttributestring The data attribute to set or remove.
valuestring The value to set for the data attribute.
-
getLayoutProperties()
-
Returns the 'afs:layout' properties. Empty object if no layout property is present.
Returns:
The 'afs:layout' properties.
- Type
- object
-
getModel()
-
Returns the model of the form field.
Returns:
The model of the form field.
- Type
- object
-
subscribe()
-
Subscribes the field to the model.
Throws:
-
Throws an error if the field does not subscribe to the model.
- Type
- string
-
-
initializeHelpContent()
-
Initializes the help content based on the state.
Throws:
-
Throws an error if the method is not implemented.
- Type
- string
-
-
getInstanceManager()
-
Returns the instance manager of the form field.
Returns:
The instance manager of the form field.
- Type
- object