Multiple default values

Lets say you have some input type where maximum is 0:

<occurrences minimum="1" maximum="0"/>

How can you set a list of default values?

Tried this in in Enonic XP 6.9.2 (didn’t work):

<default>first</default>
<default>second</default>
1 Like

We might not have implemented an array of default values I guess, but it should be possible to do like you suggest…

Hi Christian,

It would be good to have some more input. Can you give us an example use case?

Regards,
Morten

Here’s an example, by default use all colors, not just one.

<input name="colors" type="ComboBox">
    <label>Colors</label>
    <occurrences minimum="0" maximum="0"/>
    <config>
        <option value="#fdbb2f">orange (#fdbb2f)</option>
        <option value="#444444">grey-darker (#444444)</option>
        <option value="#888888">grey (#888888)</option>
        <option value="#c1c1c1">grey-light (#c1c1c1)</option>
    </config>
    <default>#fdbb2f</default>
    <default>#444444</default>
    <default>#888888</default>
    <default>#c1c1c1</default>
</input>

I’m more curious of when will this actually be useful, do you have a live content type example where this is very useful for editors…

What is or isn’t “very useful for editors” is difficult for me to know.

The example above is used to set which colors to use in highchart by default.
The list of colors could be a lot longer, still the default should be more than one color, in case the chart has multiple graphs.

Funny none of these charts actually uses more than one graph:

The most facinating about that page is the discovery that Posten has 15 times the revenue of Apple :-). Maybe someone should be tipped of to swap millions and billions?

Why not simply hardcode the default colors in your code in this case?

Because you might for example use different colours in different charts…

This “silly” example should not be the determining factor on whether a list of values is useful as a default setting.

I’m thinking more along the lines of what values are possible in JSON should also be possible in the XML.

Another example could be YML files for Ruby on Rails.

Even neater would be programmable configs :slight_smile: but that discussion has been covered before.

1 Like

This argument makes even more sense:

What values are possible to achieve by making a selection, should also be possible as default value.

Sitenote: I wonder how the xml syntax could look for item sets with multiple default values…

We have decided to not improve this now. We might get to it later.