Text form field component written in HTL.
- Provides the following type of input:
- text
- textarea
- telephone
- date
- number
- password
- Custom constraint messages for the above types
The Form Text component uses the com.adobe.cq.wcm.core.components.models.form.Text
Sling Model for its Use-object.
The following configuration properties are used:
./displayValidation
- defines whether the text field should display a label for the validation messages.
The following properties are written to JCR for this Form Text component and are expected to be available as Resource
properties:
./type
- defines the type of text this field provides; possible values:text
,textarea
,email
,tel
,date
,number
,password
./rows
- defines the number of text lines available in this input field./jcr:title
- defines the label to use for this field./hideTitle
- if set totrue
, the label of this field will be hidden./name
- defines the name of the field, which will be submitted with the form data./value
- defines the default value of the field./helpMessage
- defines a help message that can be rendered in the field as a hint for the user./usePlaceholder
- if set totrue
, the help message will be displayed inside the form input if the field is empty and not focused./constraintMessage
- defines the message displayed as tooltip when submitting the form if the value does not validate the chosen type./required
- if set totrue
, this field will be marked as required, not allowing the form to be submitted until the field has a value./requiredMessage
- defines the message displayed as tooltip when submitting the form if the value is left empty./readOnly
- if set totrue
, the filed will be read only./id
- defines the component HTML ID attribute.
The component provides a core.wcm.components.form.text.v2
client library category that contains a JavaScript component.
It should be added to a relevant site client library using the embed
property.
It also provides a core.wcm.components.form.text.v2.editor
editor client library category that includes JavaScript
handling for dialog interaction. It is already included by its edit dialog.
BLOCK cmp-form-text
ELEMENT cmp-form-text__help-block
ELEMENT cmp-form-text__textarea
ELEMENT cmp-form-text__text
ELEMENT cmp-form-text__validation-message
Apply a data-cmp-is="formText"
attribute to the wrapper block to enable initialization of the JavaScript component.
The following attributes can be added to the same element to provide options:
data-cmp-constraint-message
- populated withconstraintMessage
from the component's edit dialogdata-cmp-required-message
- populated withrequiredMessage
from the component's edit dialog
A data-cmp-hook-form-text="input"
attribute should be added to the input field or textarea so that the JavaScript is able to target it.
- Vendor: Adobe
- Version: v2
- Compatibility: AEM 6.3
- Status: production-ready
- Documentation: https://www.adobe.com/go/aem_cmp_form_text_v2