I like your solution, but you are using an IntegerSelectChoice as your model, which won't work for me. I need to set my model to a regular Integer since that's what's being persisted on the backend.
Michael -----Original Message----- From: Doug Donohoe [mailto:[EMAIL PROTECTED] Sent: Friday, May 09, 2008 2:23 PM To: users@wicket.apache.org Subject: RE: DropDownChoice throws IllegalArgumentException with Integer values Yes, I'm on 1.4-m1. However, you can remove all the generic stuff and it will still work. I just migrated to generics yesterday, so the code does work on 1.3.3. Or you can invest in moving to 1.4-m1. It seems to be working great and using generics is nice. -Doug Michael Mehrle wrote: > > Hi Doug: > > Thanks for that - this might just work :-) One problem I'm running into > is that the version of IChoiceRenderer I am using cannot be > parameterized (it's not generic). Do you have a different wicket release > than I do? > > I'm on 1.3.3. > > Michael > > -----Original Message----- > From: Doug Donohoe [mailto:[EMAIL PROTECTED] > Sent: Friday, May 09, 2008 9:30 AM > To: users@wicket.apache.org > Subject: RE: DropDownChoice throws IllegalArgumentException with Integer > values > > > I posted on my wiki how I solved this problem. Hopefully it will help > you: > > http://wiki.donohoedigital.com/wiki/Wiki.jsp?page=DropDownChoice+Example > > -Doug > > > Michael Mehrle wrote: >> >> The code is pretty massive, would be tough to post all that here. >> Basically, it's an integer backed DropDownChoice that has the word >> 'guest' tagged on to incrementing numbers (e.g. 1 - 10) in the label. >> When I remove the word 'guest' in the label it works just fine. Did > your >> dropdown have integers as the labels or was there more? >> >> It seems that the problem lies in the conversion, and that Wicket >> somehow is trying to grab the label value and put it into the model. >> >> If anyone has run into such a problem I'd appreciate any input. >> >> Michael >> >> >> >> -----Original Message----- >> From: Doug Donohoe [mailto:[EMAIL PROTECTED] >> Sent: Friday, May 09, 2008 8:41 AM >> To: users@wicket.apache.org >> Subject: RE: DropDownChoice throws IllegalArgumentException with > Integer >> values >> >> >> Post your code. It's hard to guess w/out seeing the code. I have an >> integer-based drop down choice working well (I used that example as my >> starting point). >> >> -Doug >> >> >> Michael Mehrle wrote: >>> >>> Anyone? Was hoping for some input here ;-) >>> >>> -----Original Message----- >>> From: Michael Mehrle [mailto:[EMAIL PROTECTED] >>> Sent: Thursday, May 08, 2008 6:35 PM >>> To: users@wicket.apache.org >>> Subject: RE: DropDownChoice throws IllegalArgumentException with >> Integer >>> values >>> >>> Okay, I just stepped through this and getting the feeling that >> 'somehow' >>> the label is being passed on to the model. Now, if the label is '1' > it >>> works fine, but if it's '1 day', then I get that error. >>> >>> The question here is: why is the label being passed back to the > model? >>> Doesn't make any sense - I'm using a ChoiceRenderer as such: >>> >>> new ChoiceRenderer("label", "value") >>> >>> Do I also need to add some kind of converter to properly assign the >>> model? >>> >>> Any input would be appreciated. >>> >>> Michael >>> >>> -----Original Message----- >>> From: Michael Mehrle [mailto:[EMAIL PROTECTED] >>> Sent: Thursday, May 08, 2008 5:19 PM >>> To: users@wicket.apache.org >>> Subject: DropDownChoice throws IllegalArgumentException with Integer >>> values >>> >>> This is the error I'm getting: >>> >>> >>> >>> [DEBUG LoadAdDataInterceptor] Loaded >>> AdData:[EMAIL PROTECTED] >>> >>> [ERROR RequestCycle] Cannot format given Object as a Number >>> >>> java.lang.IllegalArgumentException: Cannot format given Object as a >>> Number >>> >>> at java.text.DecimalFormat.format(DecimalFormat.java:480) >>> >>> at java.text.Format.format(Format.java:133) >>> >>> at >>> >> > org.apache.wicket.util.convert.converters.AbstractNumberConverter.conver >>> tToString(AbstractNumberConverter.java:109) >>> >>> at >>> >> > org.apache.wicket.util.lang.PropertyResolverConverter.convert(PropertyRe >>> solverConverter.java:84) >>> >>> >>> >>> I'm using List<SelectOption> to populate the DropDownChoice, as per >> the >>> online example: >>> >>> >>> >>> >> > http://cwiki.apache.org/WICKET/another-dropdownchoice-example-by-adam.ht >>> ml >>> >>> >>> >>> The only change I made to SelectOption is to set the 'value' field to >> an >>> Integer (which I need for my model). >>> >>> >>> >>> Anyone any ideas as to what's going on? I'm pretty sure I didn't swap >>> the label/value pairs as the labels show up properly. >>> >>> >>> >>> Thanks, >>> >>> >>> >>> Michael >>> >>> >>> --------------------------------------------------------------------- >>> 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] >>> >>> >>> >> >> -- >> View this message in context: >> > http://www.nabble.com/DropDownChoice-throws-IllegalArgumentException-wit >> h-Integer-values-tp17139227p17150771.html >> Sent from the Wicket - User 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] >> >> >> > > -- > View this message in context: > http://www.nabble.com/DropDownChoice-throws-IllegalArgumentException-wit > h-Integer-values-tp17139227p17151647.html > Sent from the Wicket - User 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] > > > -- View this message in context: http://www.nabble.com/DropDownChoice-throws-IllegalArgumentException-wit h-Integer-values-tp17139227p17156630.html Sent from the Wicket - User 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]