How to make the multifiled readonly in Touch UI | Community
Skip to main content
Level 4
July 13, 2023

How to make the multifiled readonly in Touch UI

  • July 13, 2023
  • 1 reply
  • 1117 views

Hi Team ,

I am trying to make multifiled readonly in Touch UI in aem 6.5.But it is not working as expected. 

 

<options
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
composite="{Boolean}true"
renderReadOnly="{Boolean}true"
fieldLabel="Add Options">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./hearEvServiceOptions">
<items jcr:primaryType="nt:unstructured">
<text
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Text"
name="./optionText"/>
</items>
</field>
</options>

 

Any suggestion would be helpful. Thank you in advance.

Thanks,

Sandeep. 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Sady_Rifat
Community Advisor
Community Advisor
July 13, 2023

Hello @sandeep6 ,

As per the documentation read-only is not supported in multifield, https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/multifield/index.html 

If you need this to meet the business requirement you can write custom JS and integrate with the component dialog by extraclientlibs. Add an additional class in the multifield and based on that class disable the 'Add' button.

Mahedi_Sabuj
Community Advisor
Community Advisor
July 13, 2023

Hi @sandeep6, Although Multifield extend Field component, readOnly is not supported in multifield as @sady_rifat mentioned. Alternatively, you can add readOnly={Boolean}true to all the dialog fields of multifield, then all of the fields will be Read Only. 

<listItems jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/multifield" composite="{Boolean}true" fieldDescription="Click 'Add Field' to add more item in list." fieldLabel="Item List" required="{Boolean}true"> <field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container" name="./listItems"> <items jcr:primaryType="nt:unstructured"> <firstName jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldLabel="First Name" readOnly="{Boolean}true" name="./firstName"/> <lastName jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldLabel="Last Name" readOnly="{Boolean}true" name="./lastName"/> </items> </field> </listItems>

 

Mahedi Sabuj