Re: [Wicket-user] set static values on DropDownChoice
* Vincent Jenks: [...] how can I set, say, a Map of name/value pairs of Strings? In this case I'm not providing a ListT of values to the dropdown but rather a MapString, String of static values - unless of course there's an easier way. This control still feels cumbersome to work worthperhaps it's just me? I agree it's a bit tricky to make DropDownChoice display a label different from the ID. You have to use the constructor with the IChoiceRenderer as last argument: DropDownChoice(java.lang.String id, IModel model, IModel choices, IChoiceRenderer renderer) Then you must implement a new IChoiceRenderer, passing your map to the constructor. Feel free to contribute it to Wicket when you're done, it will be useful for most of us: Currently the only IChoiceRenderer implementation is ChoiceRenderer, but the ID (value submitted) is the index in the choices list, not an arbitrary String value. HTH, -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] set static values on DropDownChoice
That wouldn't work then. I would typically use some wrapper object in that case. public class Foo { private String bar; public String toString() { return bar; } } The feed the dropdown with a list of Foo Eelco On 7/19/06, Jean-Baptiste Quenot [EMAIL PROTECTED] wrote: * Eelco Hillenius: A poor-man's method is to override toString. Do you have an example at hand please? My usecase is that the choice value is a String (not the index in the list), and the choice label is another String. -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] set static values on DropDownChoice
This seems like a lame question but I'm struggling again w/ the DropDownChoice control (using 1.2). I simply want to set static values to a DropDownChoice control so they can be drawn out later in the form's input class when it's submitted. I thought I had done this before but can't find that I have - how can I set, say, a Map of name/value pairs of Strings? In this case I'm not providing a ListT of values to the dropdown but rather a MapString, String of static values - unless of course there's an easier way. This control still feels cumbersome to work worthperhaps it's just me? Thanks! - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user