I've created an AEM Touch UI multifield
in a component dialog node. It has a sub-field of select
. The select control contains a list of permissions. The idea is that an author can select multiple permissions and the user must have at least one of those permissions in order to see the component, or if no permissions are specified for that component, all users will see it. Below is the .content.xml
file for the dialog tab (the tab gets included via granite/ui/components/foundation/include
reference).
I can add new permissions to the multifield, change them, and remove them with one caveat: I can't remove the last permission in the list. For some reason, AEM isn't allowing me to have an empty multifield once I've selected something. I've tried setting allowBlank
to true, but I don't think this property applies to the Touch UI--either way, it doesn't fix the issue.
How can I allow a content author to remove all items in the multifield?
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/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="Portal Filters"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<permissions
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
fieldDescription="A user must have at least one of these permissions to view this component"
fieldLabel="Permissions">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
name="./permissions">
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="/apps/mportal/datasources/permissions"/>
</field>
</permissions>
<missions
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
fieldDescription="A user must have at least one of these missions to view this component"
fieldLabel="Missions">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
name="./missions">
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="/apps/mportal/datasources/missions"/>
</field>
</missions>
<mtcs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
fieldDescription="A user must have at least one of these mtcs to view this component"
fieldLabel="MTCs">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
name="./mtcs">
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="/apps/mportal/datasources/mtcs"/>
</field>
</mtcs>
<languages
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
fieldDescription="A user must have at least one of these languages to view this component"
fieldLabel="Languages">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
name="./languages">
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="/apps/mportal/datasources/languages"/>
</field>
</languages>
<startdate
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/datepicker"
fieldLabel="Start Date"
name="./startdate"/>
<enddate
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/datepicker"
fieldLabel="End Date"
name="./enddate"/>
</items>
</jcr:root>