How to use Radio Buttons in multilang environment?

I am trying to set some data property to radio button so that I can decide which button was selected according to data property.
But when I try this:

paymentChoices = new OptionGroup(paymentCaption);
String paymentCredit = Messages.getString(“ChoosePaymentPane.payment_credit”);
Item paymentItem = paymentChoices.addItem(paymentCredit);
paymentItem.addItemProperty(“payment_type”, new ObjectProperty(“billing”));

I get exception from IndexedContainer$IndexedContainerItem.
What is correct way to do this?

Hi,

Add the property to the Container (in this case to the OptionGroup itself), for instance:

paymentChoices.addContainerProperty("payment_type", String.class, null);

The set the item’s property, e.g:

paymentItem.getItemProperty("payment_type").setValue("billing");

In this case the default Container for OptionGroup (IndexedContainer) creates the Items and adds Properties; this is usually the case because all Items in a Container must have the same Properties.

Hope this helps!

Best Regards,
Marc

Thank you very much!

This solved my problem.

Timo