Hi all,

I have a form with a Radiogroup :

In my form, I have a radiogroup like this :
        RadioGroup<String> genre = new
RadioGroup<String>("genreDestinataire");
        genre.setRequired(true);
        genre.setLabel(new Model<String>("Genre destinataire"));
        genre.add(new Radio<String>("femme", new Model<String>("f")));
        genre.add(new Radio<String>("homme", new Model<String>("h")));
        genre.add(new Radio<String>("mixte", new Model<String>("b")));
        form.add(genre);

This radiogroup match the genreDestinataire field in Questionnaire Entity
(with a CompoundPropertyModel).

In my unit test, I try to check what radio is selected, but I don't find
how...
I can get Model Object from radioGroup like this :
        String genreObtenu =
((RadioGroup<String>)form.get("genreDestinataire")).getDefaultModelObjectAsString();

but it works even if none of radio is checked. It happen when I fill the
form with existant Questionnaire : radiogroup model is ok, but none of radio
is checked.
Before correct this bug, I want to reproduce it in test, but I didn't find
how to see if a radio is checked or not : I didn't find any method like
"isChecked" or "isSelected" on Radio Component.

Is there any way to check that ?

Thanks.
M.

-- 
*Mathilde Pellerin*
Ingénieur en développement de logiciel

STATLIFE
tel : 01.42.11.64.88
mail : [email protected]

Reply via email to