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 id
string The ID to set for the form field.
-
setParent(parentView)
-
Sets the parent view of the form field.
Parameters:
Name Type Description parentView
object The parent view to set for the form field.
-
setInstanceManager(instanceManager)
-
Sets the instance manager for the form field.
Parameters:
Name Type Description instanceManager
object 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 model
object 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 property
boolean The property to toggle.
dataAttribute
string The data attribute to set or remove.
value
string 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 element
HTMLElement The element to toggle.
property
boolean The property to toggle.
dataAttribute
string The data attribute to set or remove.
value
string 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