Bug with required fields inside optional item-set

Enonic version: 6.3.0
OS: Mac OSX

I have the following part in my site config:

<config>
    <item-set name="important-message">
        <label>Important message</label>
        <occurrences minimum="0" maximum="1"/>
        <items>
            <input name="text" type="TextLine">
                <label>Message</label>
                <occurrences minimum="1" maximum="1"/>
            </input>
            <!-- Other not-required fields -->
        </items>
    </item-set>
    <!-- Other config -->
</config>

As you might notice, the <item-set /> occurrence count is set to optional (minimum="0" maximum="1"), while the text input is set to required. The way I assumes this should work is that I might or might not have an important-message, but if I have one, I must have a message specified.

It saves when I remove the important-message, and everything looks great - but once I reload the admin page, the application box for the site turns red (because the site config is invalid). I open it up, and there’s an empty important-message there.

A temporary fix is to make every field optional and change my validation logic - but I would rather you fix the issue.

1 Like

Sounds like a bug indeed. We’ll look into it asap.

The bug is fixed. The fix will be included in the upcoming version 6.4 of Enonic XP.

1 Like