optiongroup select strange behavior


I have Form with an attached FormFieldFactory. The form is populated from an ItemDatasource.

The optionGroup class is used for checkboxes and radio button.

In radio button mode I cannot preselect any options programmatically. Also when the user is selecting an option the selection only stays for a very short time and disappears after the form is repopulated.
In checkbox mode (multiselect allowed) everything works fine.

How can I programmatically select a radiobutton option? I already searched the forum, but I didn’t find a working solution.

It should work with OptionGroup just as well as with any selection component.

Notice that in single-select mode, you need to give the item ID of the selected item in setValue(), while in multi-select mode it’s a collection of item IDs. Or as the value of the property, if the OptionGroup is bound to a property in an item data source.

Thanks the issue was in a custom Property class which returned List in its getValue() method, but it should have returned ID instead for radio buttons.