You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Coral UI多选下拉无法清空所有值,保存后恢复的问题咨询

Fixing the Issue Where AEM Multi-Select Dropdown Won't Save Empty State

Hey there, I’ve run into this exact behavior with AEM’s Granite UI multi-select components before. The problem is that when you deselect all options, the component doesn’t actually submit an empty value to the server—so the backend just keeps the last saved values instead of clearing them. The good news is, you just need to add two simple properties to fix this.

The Solution: Add forceEmptySubmit and emptyText

You’ll want to add these two attributes to your select node:

  • forceEmptySubmit="{Boolean}true": Forces the component to send an empty value to the server when no options are selected
  • emptyText="": A required companion property (even with an empty string) to make forceEmptySubmit work correctly with the select component

Here’s your updated schema configuration:

<_x0031_480609690955 jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/select" 
    fieldLabel="My Dropdown" 
    multiple="true" 
    name="./jcr:content/metadata/mydropdown" 
    renderReadOnly="true"
    forceEmptySubmit="{Boolean}true"
    emptyText=""> 
    <granite:data jcr:primaryType="nt:unstructured" metaType="dropdown"/> 
    <items jcr:primaryType="nt:unstructured"> 
        <_x0031_480609702507 jcr:primaryType="nt:unstructured" text="Value 1" value="value_1"/> 
        <_x0031_480609703314 jcr:primaryType="nt:unstructured" text="Value 2" value="value_2"/> 
        <_x0031_480609706365 jcr:primaryType="nt:unstructured" text="Value 3" value="value_3"/> 
    </items> 
</_x0031_480609690955>

Why This Works

  • forceEmptySubmit changes the component’s default behavior: instead of skipping the field when nothing’s selected, it explicitly sends an empty value. This tells the AEM backend to clear the stored metadata value instead of retaining the last one.
  • emptyText is a quirk of the Granite UI select component—it needs this property present (even as an empty string) to enable the forceEmptySubmit functionality. Without it, the component won’t trigger the empty submission.

After adding these properties, you’ll be able to deselect all options, save, and the dropdown’s value will stay empty instead of reverting to the last saved selection.

内容的提问来源于stack exchange,提问作者Riju Mahna

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 10:05:02