Enonic version: 7.2.3
Throughout our site we use several optional item sets in our parts and layouts, i.e. item sets with
<occurrences minimum="0" maximum="1"/>. Some input fields (RadioButtons and ComboBoxes) inside
<items>have default values, which I expect to be used when adding one (or more) occurence(s) of the items. In Enonic XP 6.15 this is also what I have experienced, but upgrading to Enonic XP 7.2, the default values suddenly seems to cause an instance of the items to be generated automatically.
This sample layout illustrates the issue:
<layout> <display-name>Test layout</display-name> <form> <item-set name="myItems"> <label>Item</label> <items> <input name="value" type="RadioButton"> <label>Value</label> <occurrences minimum="1" maximum="1"/> <config> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </config> <default>1</default> </input> </items> <occurrences minimum="0" maximum="1"/> </item-set> </form> <regions> <region name="main"/> </regions> </layout>
I would expect the form in content studio to look like this when first adding the layout to a page:
(this is also how it would look in 6.15)
But in XP 7 it looks like this:
As you can see, the item is added automatically (I never get the button), even though it should be optional to add it. Removing the default value of the radio button fixes the problem, but then I won’t have a default value for the radio button when the editor actually choses to add an item.
In our production code we have much more complex item sets, and removing all default values is not an option. Neither is requiring editors to X-out (close) autogenerated items when not needed. Currently this issue stops us from going in production with XP 7.