allowBlank on select in multifield (Touch UI) doesn't work | Community
Skip to main content
Level 2
October 16, 2015
Solved

allowBlank on select in multifield (Touch UI) doesn't work

  • October 16, 2015
  • 12 replies
  • 3577 views

Using the Touch UI interface, I have a 'multifield' that contains a series of 'select' fields.  I can select, change, and delete items in this multifield just fine, however, when I try to remove the last remaining 'select' from the multifield and save, the last item is not removed.  I've tried setting the 'allowBlank' property to true, but it still won't let me remove the last item from the multifield.  Any ideas on how I can achieve this?

UPDATE

Here is the contents of my .content.xml file for the cq:dialog node.  The /jcr:root/content/items/section-filters/items/permissions node is the offender.  I'm not sure that 'allowBlank' is a valid property in the Touch UI:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/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="Edit Portal Component" sling:resourceType="cq/gui/components/authoring/dialog"> <content jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container"> <layout jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/layouts/tabs"/> <items jcr:primaryType="nt:unstructured"> <section-properties jcr:primaryType="nt:unstructured" jcr:title="Properties" sling:resourceType="granite/ui/components/foundation/container"> <items jcr:primaryType="nt:unstructured"> <caption jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" fieldDescription="A caption for the component" fieldLabel="Caption" name="./caption"/> <applet-size jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" fieldDescription="1-12 or flush" fieldLabel="Applet Size" name="./applet-size"/> </items> </section-properties> <section-filters 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" name="./permissions"> <field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" allowBlank="{Boolean}true" name="./permissions"> <datasource jcr:primaryType="nt:unstructured" sling:resourceType="/apps/mportal/datasources/permissions"/> </field> </permissions> <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> </section-filters> </items> </content> </jcr:root>
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 harrisonreed

It turns out there is an issue with the way AEM Touch UI multifield components update values. If you remove the last item, the component sends no value up to the server (much like an unchecked checkbox). You have to explicitly tell AEM that you want to delete the value of a multifield if there are no items in it. Here's how:

  1. At the same level as your multifield node, create a new node (nt:unstructured); I call it permissions-delete (to correspond with my multifield called permissions)
  2. Add the following properties:
    1. sling:resourceTypeStringgranite/ui/components/foundation/form/hidden
    2. nameString./permissions@Delete (where ./permissions is the value of name field of the permissions/field node)
    3. valueBoolean, true

Now when you remove the last item, the value of the hidden field will ensure that it is deleted and not just ignored.

12 replies

Community Advisor
October 16, 2015

Hi Harrison,

I don't think it is the problem with your code.  I tried out of box geometrixx-outdoors tab /apps/geometrixx-outdoors/components/tabctrl component which is also a multifield widget. 

I dragged and dropped on geometrixx-outdoors home page and created tabs, when I remove them I see the same problem as yours.

I cannot remove all of them at once, I need to remove one at a time and save. Last one remains, we cannot get rid of this.

It seems that coral ui events might be having issues in saving the data to node.

I request community members from Adobe test it and file a ticket for fix.

Thanks

Level 2
October 16, 2015

Thank you, I verified this with the Admitted Groups field on page properties in the Geometrixx site, and found the same thing there--apparently a bug in the Touch UI.