Wicket DropDownChoice Advice
Yes, I admit it, the DropDownChoice is tough!
After spending way too many hours on it, I have the following advice. If you are trying to bind the value of your dropdownchoice to anything besides a String, that's fine and dandy, but don't try to have the DropDownChoice bind DIRECTLY to your value. For example, if you have a Double, Long, whatever, you should set it yourself. How do you do this? By having the DropDownChoice bind to some pojo, and you use that pojo value to set your Double/Long/Whatever.
My case was that I wanted to populate a DropDownChoice of possible Mile Radius (i.e. 1 Mile, 10 Miles, etc) and the value would be a double (i.e. 1.0D, 10.0D) Could not get this to happen. Finally, I just created a pojo called SelectedDistance with 2 properties. This was undated fine by the DropDownChoice. I just updated my Double property to the value of my SelectedDistanced distance value.
Code is here:
http://stitches.googlecode.com/svn/trunk/stitches-client/src/java/org/au...

Comments
Hello Phillip, great example.
Hello Phillip, great example. The DropDownChoice list part works OK but I can't get the DropDown selected item to work. This means I don't have the index valued available for use when the form is submitted. Regards, David.
Post new comment