@James - Thank you will try that out and get back. @Martin - Thanks mate will get back I guess I am using 1.4.9 version and don't have the option to setDefaultModelObject on the ChoiceRenderer anyhow appreciate your time and thoughts to write back.
Thanks again Nive On Thu, Feb 10, 2011 at 12:01 PM, Martin Makundi < [email protected]> wrote: > Hi! > > You can do defaultChoiceRenderer.setDefaultModelObject(xxx) > > Or if you don't want to dirty it, you can use > > public static <T extends FormComponent<?>> void fakeRawInput(T > formComponent, T existingComponent) { > try { > String rawInput = (String) rawInputField.get(existingComponent); > fakeRawInput(formComponent, rawInput); > } catch (Exception e) { > Utils.errorLog(WicketUtils.class, "Fatal Error: Form field > access failed.", e); > } > } > > > 2011/2/10 Niv <[email protected]>: > > > > Hi > > Is there a way I can have the selected option on a DropDownChoice to be > set > > with one of the items in the Model instead of ' Choose One' as the > > selected item by default? I know this has been asked around in a > different > > sense but I could not find a closer match to this. > > Code Snippet > > > > List<Country> countryList =service.getCountries(); > > ChoiceRenderer<Country> defaultChoiceRenderer = new > > ChoiceRenderer<Country>(Constants.NAME, Constants.ID); > > countryChoice = new DropDownChoice<Country>(Constants.ADDRESS_COUNTRY, > > countryList, defaultChoiceRenderer); > > > > //Would like the countryChoice to be able to have the First Contry in the > > countrList to be the one rendered instead of 'Choose One'. > > > > Thanks and if it seems redundant do pardon me > > Cheers > > > > > > > > -- > > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Choose-One-Selected-Item-tp3298535p3298535.html > > Sent from the Users forum mailing list archive at Nabble.com. > > > > --------------------------------------------------------------------- > > 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] > >
