where and how are you actually pulling out the selection? -igor
On Fri, Jul 17, 2009 at 1:21 AM, Trojahn, Cassia<[email protected]> wrote: > Igor Vaynberg wrote: >> >> where is your Form in your example? >> >> -igor >> >> On Thu, Jul 16, 2009 at 7:04 AM, Trojahn, >> Cassia<[email protected]> 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: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >>> I send the code of the application. >>> if someone can help me .... >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > Thank you for your reply, but with the form the problem is not solved (I > attach the code with the form). > Any other idea? > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
