Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Maxlength not working on fields under Composite Multifield

Avatar

Level 1

Hi all

At AEM 6.3.2.2, We are having the following dialog of the component, where in the maxlength is not working for textarea,

- does it work for a field within multifield ?

- What could be the issue ?

<?xml version="1.0" encoding="UTF-8"?>

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"

    jcr:primaryType="nt:unstructured"

    jcr:title="Cards"

    sling:resourceType="cq/gui/components/authoring/dialog">

    <content

        jcr:primaryType="nt:unstructured"

        sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">

        <items jcr:primaryType="nt:unstructured">

            <column

                jcr:primaryType="nt:unstructured"

                sling:resourceType="granite/ui/components/coral/foundation/container">

                <items jcr:primaryType="nt:unstructured">

                    <cards

                        jcr:primaryType="nt:unstructured"

                        sling:resourceType="granite/ui/components/coral/foundation/form/multifield"

                        composite="{Boolean}true"

                        fieldDescription="Click 'Add Field' to add a new card.">

                        <field

                            jcr:primaryType="nt:unstructured"

                            sling:resourceType="granite/ui/components/coral/foundation/container"

                            name="./cards">

                            <items jcr:primaryType="nt:unstructured">

                                <titleGroup

                                    granite:hide="${cqDesign.titleHidden}"

                                    jcr:primaryType="nt:unstructured"

                                    sling:resourceType="granite/ui/components/coral/foundation/well">

                                    <items jcr:primaryType="nt:unstructured">

                                        <title

                                            jcr:primaryType="nt:unstructured"

                                            sling:resourceType="granite/ui/components/coral/foundation/form/textfield"

                                            fieldDescription="A title to display as the headline for the teaser."

                                            fieldLabel="Title"

                                            name="./title"

                                            value="${cqDesign._jcr_description}"/>

                                    </items>

                                </titleGroup>

                               <description

                                    jcr:primaryType="nt:unstructured"

                                    sling:resourceType="granite/ui/components/coral/foundation/form/textarea"

                                    fieldLabel="Description"

                                    maxlength="{Long}100"

                                    name="description"/>

                                <linkURL

                                    jcr:primaryType="nt:unstructured"

                                    sling:resourceType="granite/ui/components/foundation/form/pathbrowser"

                                    fieldLabel="Link to"

                                    name="linkURL"

                                    rootPath="/content"/>

                                <imageLink

                                    jcr:primaryType="nt:unstructured"

                                    sling:resourceType="granite/ui/components/foundation/form/pathbrowser"

                                    fieldLabel="Card Image Link"

                                    name="imageLink"

                                    rootPath="/content/dam/ana-ems"/>

                                <linkLabel

                                    jcr:primaryType="nt:unstructured"

                                    sling:resourceType="granite/ui/components/coral/foundation/form/textfield"

                                    fieldDescription="A title to display as the headline for the teaser."

                                    fieldLabel="Link Label"

                                    name="./linkLabel"/>

                            </items>

                        </field>

                    </cards>

                </items>

            </column>

        </items>

    </content>

</jcr:root>

1 Accepted Solution

Avatar

Correct answer by
Level 10

check textarea-6.3 · GitHub

<textarea
  jcr:primaryType="nt:unstructured"
  sling:resourceType="granite/ui/components/coral/foundation/form/textarea"
  granite:id="texfield_textarea"
  emptyText="e.g. Text Area Content"
  fieldDescription="Required. Maximum length of 300 characters."
  fieldLabel="Text Area"
  maxlength="300"
  name="./textarea"
  required="{Boolean}true"/>

View solution in original post

2 Replies

Avatar

Community Advisor

Not sure about why you are getting this error. but probably you can check the error log or console.

one more thing to make sure, you shouldn't put the 100 in double quotes in dialog. also if still creating a problem then try to write a listener for this dialog.

I will check in my machine and confirm you back.

Avatar

Correct answer by
Level 10

check textarea-6.3 · GitHub

<textarea
  jcr:primaryType="nt:unstructured"
  sling:resourceType="granite/ui/components/coral/foundation/form/textarea"
  granite:id="texfield_textarea"
  emptyText="e.g. Text Area Content"
  fieldDescription="Required. Maximum length of 300 characters."
  fieldLabel="Text Area"
  maxlength="300"
  name="./textarea"
  required="{Boolean}true"/>