Details
-
Bug
-
Resolution: Obsolete
-
Neutral
-
None
-
5.4.2
-
None
Description
Sometimes it is more or less logical to have a option in a dropbown box with an empty value. E.g. we used it to indicate 'leave this value empty and inherit it from parent nodes'. But is does not work, and unexpectedly the name of the option is used then.
See
info.magnolia.ui.form.field.factory.SelectFieldFactory
/**
* Backward compatibility.
* If value is null, <br>
* - get the Name as value.<br>
* - If Name is empty, set Label as value.
*/
private String getValue(SelectFieldOptionDefinition option) {
if (StringUtils.isBlank(option.getValue())) {
if (StringUtils.isNotBlank(option.getName())) {
return option.getName();
} else {
return getMessage(getLabel(option));
}
} else {
return option.getValue();
}
}
The code is also private, so it is hard to change this default somewhat counter intuitive behaviour.
I'm not sure how this facilitates some backwards compatibility. It may do, I'm not sure. I'd sure like an option to switch on/off this.
Checklists
Acceptance criteria