Hi,

Any help on this issue regarding the  RadioChoice component will be
appreciated.

I'm having difficiltius showing the (previously) selected RadioChoice, and
can not figure out what's going wrong.

Here is my code:

public class QuestionRightPanel extends Panel {
    private String selectedValue;
    private RadioChoice radioChoice;
    ...
    public QuestionRightPanel() {
    ...
    radioChoice = new RadioChoice("radioChoice", new MyModel(),
yesNoChoices, new ChoiceRenderer("label", "value")).setSuffix("");
    ...
    selectedValue = getAlreadyChoosenValue();
    if (questionAnswered) {
        radioChoice.setVisible(true);
        radioChoice.setEnabled(false);
       radioChoice.setModelObject(new
LabelValue(convertYesNo(selectedValue), selectedValue));
    }

    class MyModel extends Model {

        @Override
        public Object getObject() {
            return selectedValue;
        }

        @Override
        public void setObject(Serializable object) {
            if (object != null) {
                // set the yes-no value choosen.
                selectedValue = ((LabelValue) object).getValue();
            }
        }
    }

As seen i don't want the user to answer the question again by disabling the
radioChoice if the
question already has been answered.
By why can't i set the default selected option to be the value i desire by
the code:
      radioChoice.setModelObject(new LabelValue(convertYesNo(selectedValue),
selectedValue));

Hope someone has the answer...

Best Regards
Muro

Reply via email to