Re: DropDownChoice-Choose One Selected Item

2011-02-22 Thread nivs

Hi,

Thank you for the thoughts. We managed to get around this in the following
way for completness

class TestVO{
public Country selected= countryList.get(0);//I get the first item can 
be
any other way
}

countryChoice = new DropDownChoiceCountry(voName.country, new
PropertyModel(new TestVO(),selected),countryList, defaultChoiceRenderer);

Doing this..sets the Choose One to the default value that was set in the
TestVO.

Reference:
https://cwiki.apache.org/WICKET/dropdownchoice-examples.html
https://cwiki.apache.org/WICKET/dropdownchoice-examples.html 

Thanks
Nive


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Choose-One-Selected-Item-tp3298535p3320479.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



DropDownChoice-Choose One Selected Item

2011-02-09 Thread Niv

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

ListCountry countryList =service.getCountries();
ChoiceRendererCountry defaultChoiceRenderer = new
ChoiceRendererCountry(Constants.NAME, Constants.ID);
countryChoice = new DropDownChoiceCountry(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



Re: DropDownChoice-Choose One Selected Item

2011-02-09 Thread James Carman
The DDC will reflect whatever is in its model (the model for the
selected value, not the one for the list of items to choose from).
So, just set your model.

On Wed, Feb 9, 2011 at 10:52 PM, Niv nivedan.t...@gmail.com wrote:

 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

 ListCountry countryList =service.getCountries();
 ChoiceRendererCountry defaultChoiceRenderer = new
 ChoiceRendererCountry(Constants.NAME, Constants.ID);
 countryChoice = new DropDownChoiceCountry(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



Re: DropDownChoice-Choose One Selected Item

2011-02-09 Thread Martin Makundi
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

 ListCountry countryList =service.getCountries();
 ChoiceRendererCountry defaultChoiceRenderer = new
 ChoiceRendererCountry(Constants.NAME, Constants.ID);
 countryChoice = new DropDownChoiceCountry(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



Re: DropDownChoice-Choose One Selected Item

2011-02-09 Thread Nivedan Nadaraj
@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 
martin.maku...@koodaripalvelut.com 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 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
 
  ListCountry countryList =service.getCountries();
  ChoiceRendererCountry defaultChoiceRenderer = new
  ChoiceRendererCountry(Constants.NAME, Constants.ID);
  countryChoice = new DropDownChoiceCountry(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