Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Character limit for text field inside a multi field in SP 6.5

Avatar

Level 7

Hi Team,

 

I have to limit the character for a text field inside a multi field. I'm using 6.5 SP. I have tried to "max String 3" in property level and it doesn't work. 

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @JakeCham,

According to documentation you should use maxlength property to restrict number of chars.

Here is very simple example that presents text filed with length limitation inside multi filed. I have tested it on AEM 6.5.11 but it should work on any other AEM 6.5 version.

<cq:dialog jcr:primaryType="nt:unstructured" jcr:title="Properties" 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">
                    <multi jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/multifield">
                        <field jcr:primaryType="nt:unstructured" maxlength="3" name="./value" sling:resourceType="granite/ui/components/coral/foundation/form/textfield"/>
                    </multi>
                </items>
            </column>
        </items>
    </content>
</cq:dialog>

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @JakeCham,

According to documentation you should use maxlength property to restrict number of chars.

Here is very simple example that presents text filed with length limitation inside multi filed. I have tested it on AEM 6.5.11 but it should work on any other AEM 6.5 version.

<cq:dialog jcr:primaryType="nt:unstructured" jcr:title="Properties" 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">
                    <multi jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/multifield">
                        <field jcr:primaryType="nt:unstructured" maxlength="3" name="./value" sling:resourceType="granite/ui/components/coral/foundation/form/textfield"/>
                    </multi>
                </items>
            </column>
        </items>
    </content>
</cq:dialog>