where is your Form in your example?

-igor

On Thu, Jul 16, 2009 at 7:04 AM, Trojahn,
Cassia<cassia.troj...@xrce.xerox.com> wrote:
> Trojahn, Cassia wrote:
>>
>> Always the last of the list is the selected.
>> I had tried also this proposal .. and it does not work.
>>
>> Michael O'Cleirigh wrote:
>>>
>>> Hello,
>>>
>>> I don't think you need to track the selected (true/false) state your
>>> self.  Let the radio group model do it automatically for you like:
>>>
>>> listLanguages.add(new NameWrapper("English", "en", "");
>>> listLanguages.add(new NameWrapper("German", "de", ""));
>>> listLanguages.add(new NameWrapper("French", "fr", ""));
>>> listLanguages.add(new NameWrapper("Italian", "it", "");
>>> listLanguages.add(new NameWrapper("Polish", "pl", "");
>>>
>>> // set the selected radio to be the first in the list 'English'
>>> final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery", new
>>> Model<NameWrapper>(listLanguages.get(0)));
>>> listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages) {
>>>           protected void populateItem(ListItem item) {
>>>                String lang =
>>> ((NameWrapper)item.getModelObject()).getName();
>>>               item.add(new Label("nameLanguageQuery", new
>>> StringResourceModel(lang, this, null,"XXXX")));
>>>               item.add(new Radio("checkLanguageQuery",
>>> item.getModel(),groupQuery));
>>>           }
>>>       };
>>>
>>> groupQuery.add(listLanguagesQuery);
>>>
>>> Now the model object value of the RadioGroup 'groupQuery' will have the
>>> NameWrapper for the selected choice.  A NameWrapper instance is selected if
>>> it is returned by groupQuery.getModelObject();
>>>
>>> Regards,
>>>
>>> Mike
>>>>
>>>> I had tried this option and it does not work.
>>>>
>>>> Michael Mosmann wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> .. i am not sure. The model of RadioGroup should contain, wich item is
>>>>> selected. The model of Radio should reflect the associated value. So if
>>>>> model of RadioGroup contains "fr" and Property "selected" of item nr. 3
>>>>> is "fr" this Radio is selected.
>>>>>
>>>>> maybe this will help..
>>>>> mm:)
>>>>>
>>>>>
>>>>>>
>>>>>> I have a problem when using the Radio component.
>>>>>> Using a list of languages, where each item is a NameWrapper object
>>>>>> with a property "selected". The property "selected" is associated to the
>>>>>> radio component.
>>>>>> However, when presenting to the user the corresponding list of radios,
>>>>>> the language Polish is true, and not English (it should be the selected
>>>>>> option).
>>>>>>
>>>>>>  listLanguages.add(new NameWrapper("English", "en", "", true));
>>>>>>  listLanguages.add(new NameWrapper("German", "de", "", false));
>>>>>>  listLanguages.add(new NameWrapper("French", "fr", "", false));
>>>>>>  listLanguages.add(new NameWrapper("Italian", "it", "", false));
>>>>>>  listLanguages.add(new NameWrapper("Polish", "pl", "", false));
>>>>>>
>>>>>>  final RadioGroup groupQuery = new RadioGroup("groupLanguagesQuery",
>>>>>> new Model());
>>>>>>  listLanguagesQuery = new ListView("listLanguagesQuery",listLanguages)
>>>>>> {
>>>>>>            protected void populateItem(ListItem item) {
>>>>>>                 String lang =
>>>>>> ((NameWrapper)item.getModelObject()).getName();
>>>>>>                item.add(new Label("nameLanguageQuery", new
>>>>>> StringResourceModel(lang, this, null,"XXXX")));
>>>>>>                item.add(new Radio("checkLanguageQuery", new
>>>>>> PropertyModel(item.getModel(), "selected"),groupQuery));
>>>>>>            }
>>>>>>        };
>>>>>> groupQuery.add(listLanguagesQuery);
>>>>>>
>>>>>> Any ideas? I really need to solve this issue.
>>>>>>
>>>>>> Thank you so much.
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
> I send the code of the application.
> if someone can help me ....
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to