Character limit for text field inside a multi field in SP 6.5 | Community
Skip to main content
JakeCham
Level 6
July 3, 2022
Solved

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

  • July 3, 2022
  • 1 reply
  • 4332 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by lukasz-m

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>

1 reply

lukasz-m
Community Advisor
lukasz-mCommunity AdvisorAccepted solution
Community Advisor
July 3, 2022

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>