When saving a SwitchableField called 'switch', with its default transformer:
- Default selection is ignored (expected to save at least the 'switch' property to the name of the default selected option).
- Default value of the default selection is ignored (expected to save e.g. switchtext = myDefaultTextValue)
- Only when entering changes in one of the fields will then save all properties at once.
Hint: We mostly need to trigger transformer to write to the item on switchable selection changes (see selectionListener).
As a side note:
- There should be no preselection when using radio buttons, unless explicitly configured (option selected=true)
- For select dropdowns, in case there is no default preselection, field should behave like a native select, i.e. never be blank and show first option.
- Finally, we should save switchable field's subfields 'on demand' (currently it's just all at once).
------ Original description ------
Using info.magnolia.ui.form.field.definition.SwitchableFieldDefinition with hidden fields (see attached configuration) results in two bugs:
- original switch is not reflecting its default value which is not saved
- even when switch is set to reveal hidden fields their default values are ignored as well on save
Steps to reproduce using attached config:
- Open the dialog and save without any other action
- default value of the SwitchableFieldDefinition should be saved but it's not
- default values of hidden properties should be saved as well (in this case may be intention to not save them)
- Open the dialog, set the SwitchableFieldDefinition to true (which will result in revealing two other fields), then save
- default value of SwitchableFieldDefinition is saved properly this time
- however underlying properties are still ignored until modified