Component Title | Form Text |
Description | Form Text component allows the entry of form text for submission. |
Features |
|
Location | /apps/ehi-core/aem65/components/form/text/v1/text |
sling:resourceSuperType | core/wcm/components/form/text/v2/text |
Supported AEM Versions | 6.5 |
Editing Mode | inPlaceEdit |
Component Group | Cheerios Experience |
Use Object | The Form Text component uses the com.adobe.cq.wcm.core.components.models.form.Text Sling Model for its Use-object. |
The Form Text component uses the com.adobe.cq.wcm.core.components.models.form.Text Sling Model for its Use-object.
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
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:
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.
Extending the components can be done in multiple ways depending on the needs of the brand component.
Use this approach if you do not have any required html markup changes or backend java changes. This will only update the title of the component, componentGroup and point to the resourceSuperType. Optionally can extend the description.
Use this approach if you need to update css classes or add data attributes and do not need to change the backend model, or potentially want to use a different model by retain all of the markup in the component-tmpl.html (Component Template) markup.
The component template is usually named component-tmpl.html this file contains the html markup. Update this file if you need to change the html structure of the component.
Use this approach if you need to change the Sling Model to update the backend logic.
Files that will need to be added when extending:
It is possible to extend more than just the component.html file, if necessary any file that is resourceSupertyped can be extend for example if something needs added to the dialog.
This gives us the flexibility to change our classes or add attributes easily. Say I want to add new javascript I can easily target a different data attribute to trigger my javascript.
The following properties are written to JCR for this Form Text component and are expected to be available as Resource properties:
Complete by clicking in the box below
- jcr:primaryType: nt:unstructured
- jcr:createdBy: E524Z2
- jcr:title: Label of the field
- jcr:lastModifiedBy: E524Z2
- jcr:created:
- name: Element Name
- rows: 2
- type: text
- value: Enter your text here
- jcr:lastModified:
- sling:resourceType: ehi-core/aem65/components/form/text/v1/text
- helpMessage: Complete by clicking in the box below
Complete by clicking in the box below