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 <nivedan.t...@gmail.com>:
>
> 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: 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