Unable to select default Radio button using OptionGroup

Hi,

I have used FieldFactory inside a form to generate fields, and i have used OptionGroup to generate radio buttons for a field inside a FieldFactory and aligned OptionGroup in Horizontal using CSS, just have a look at my code and here am using generateRythmRadioButtons(final String caption) to return radio buttons,

private static final List<String> rythmOptions = Arrays
			.asList(new String[] {"steadyPulse", "unEvenPulse" });      // where steadyPulse, unEvenPulse are Item Id's


private Field generateRythmRadioButtons(final String caption) {

		final OptionGroup group = new OptionGroup(null, rythmOptions);
				
		group.setNullSelectionAllowed(false);

		group.select("steadyPulse"); 

		return group;
	}

but no luck, i am not getting steadyPulse as default selected option in the page, please do clarify me.

thanks & regards in advance

Rakesh

I would say that the problem is that Form does databinding after the fields are created by using your field factory and values set in the field factory are overriden.

so,How to solve

Easiest way: set the value for your data source - you can also do that in its constructor etc. if a specific value should be used as a default.

Otherwise, you might need to manipulate the field (or data source) after setting the data source - you can’t do this in the field factory.