Re: DropDownChoice getting value into the model

2008-04-27 Thread Russell Webb
Perhaps I'm missing something big time about BoundCompoundPropertyModel. I removed my loadable detachable model and still can't get it to work specifically with a dropdown element. The following works... FormComponent networks = new DropDownChoice(network, new PropertyModel(phone, network),

Re: DropDownChoice getting value into the model

2008-04-24 Thread Russell Webb
I am experiencing something similar. My LoadableDetachableModel is wrapped with a CompoundPropertyModel. Submitting a TexTField acquires the AttachedCompoundPropertyModel whose setObject() acquires the target object and persists changes.

Re: DropDownChoice getting value into the model

2008-03-17 Thread 242
Well, IChoiceRenderer gives you ability to use any field of your custom choice object for rendering. In order to select a choice before rendering I'd implement custom choices IModel with additional method like: Object getSelected(T key) to set selection model object properly. Then I use

Re: DropDownChoice getting value into the model

2008-03-11 Thread rmattler
I don't have time to work on this right now, have real work to do. But I now believe I understand my problem. The Vendor bean needs to have the field 'state' be the class of State not String. Now I just need to figure out how to do that with Hibernate. I did buy your book. It is excellent

Re: DropDownChoice getting value into the model

2008-03-10 Thread rmattler
I don't understand. Vendor.state and SelectOption.state are both Strings. I cut down my form to only have state on the form so I can post all the code. The code pulls the correct data from the database and displays it on the form but when I save it is gives me the following error.

Re: DropDownChoice getting value into the model

2008-03-10 Thread Martijn Dashorst
First: You bind the DDC to the wrong model. You bind it directly to the LDM instead of the vendor's state property. DropDownChoice stateFC = new DropDownChoice(state, states, choiceRenderer); should be sufficient. Second: Your current setup assumes that the Vendor#state is of type

Re: DropDownChoice getting value into the model

2008-03-09 Thread Johan Compagner
This has to work yes, the only thing is do build up the new Model(states) as States so the same type of object as vendor.state returns. On 3/7/08, Kai Mutz [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: It is nice to know I'm not the only one struggling with DropDownChoices. I'm new to

Re: DropDownChoice getting value into the model

2008-03-09 Thread Johan Compagner
No it works also good, exactly the same if you where using the swing combobox. The problem that you have is that when you have an id (integer) in your object model that needs to be set but thagt id is the id of a Person then i think your object model is just plain wrong. Its not an object model at

Re: DropDownChoice getting value into the model

2008-03-09 Thread Erik van Oosten
Hi Vitaly, That is correct. For primitive model values you need something like a map. I think the DropDownBox was more designed for complex data where the data to display is embedded in the model value itself. Anyway, how would the addition of an index argument to the display method help?

Re: DropDownChoice getting value into the model

2008-03-09 Thread Vitaly Tsaplin
An index is a kind of a link between a value and its displayable representation. Having an index in getDisplayValue method we would do something like: ListInteger lang_choices = Arrays.asList (new Object [] { 1, 2, 4, 8 }); Object [] lang_labels = new Object [] { php, perl, java, c++ };

Re: DropDownChoice getting value into the model

2008-03-08 Thread Vitaly Tsaplin
Hi everyone, Hi Erik, I am sorry for so late post. But am going to go back to our DropDownChoice discussion. If you suggest me to create a list of integers and use a special renderer implementation to retrieve a displayable value you should take into account that in case if we have a

Re: DropDownChoice getting value into the model

2008-03-07 Thread Igor Vaynberg
two problems 1) loadable detachable models do not support the setobject() call, because they are...loadable. so you should use a different kind of model. 2) yes, selectoption object will be put into your model, dropdown choice works like this: DropDownChoiceT(String id, IModelT model,

RE: DropDownChoice getting value into the model

2008-03-07 Thread Kai Mutz
[EMAIL PROTECTED] wrote: I've tried for 1 1/2 days to get this simple Drop Down to work and I'm feeling stupid. My mom tells me I'm smart.:-( Everything works fine until I try to save it. I get the following error. I think it is trying to put the SelectOption object into the Model but I

Re: DropDownChoice getting value into the model

2008-03-07 Thread rmattler
Thanks for the quick reply. But you answer doesn't make sense to me. Why do loadable models work for a text field but not a drop down? If I have NY stored in the database, New York is loaded onto the form but when the form is submitted the selected value of the drop down is not saved into the

Re: DropDownChoice getting value into the model

2008-03-07 Thread Igor Vaynberg
perhaps because your textfield is setting a property of the object loaded by the model, not the object itself. -igor On Fri, Mar 7, 2008 at 1:48 PM, rmattler [EMAIL PROTECTED] wrote: Thanks for the quick reply. But you answer doesn't make sense to me. Why do loadable models work for a

Re: DropDownChoice getting value into the model

2008-03-07 Thread rmattler
It is nice to know I'm not the only one struggling with DropDownChoices. I'm new to Wicket and I'm pretty far with rebuilding an application we are using internally. Has anybody proposed an alternative or a wrapper to DropDownChoices? Vitaly Tsaplin wrote: The DropDownBox component

RE: DropDownChoice getting value into the model

2008-03-07 Thread Kai Mutz
[EMAIL PROTECTED] wrote: It is nice to know I'm not the only one struggling with DropDownChoices. I'm new to Wicket and I'm pretty far with rebuilding an application we are using internally. Has anybody proposed an alternative or a wrapper to DropDownChoices? Have you tried something like:

RE: DropDownChoice getting value into the model

2008-03-07 Thread rmattler
Thanks for trying but I get: WicketMessage: No get method defined for class: class java.lang.String expression: state Kai Mütz wrote: [EMAIL PROTECTED] wrote: It is nice to know I'm not the only one struggling with DropDownChoices. I'm new to Wicket and I'm pretty far with rebuilding

RE: DropDownChoice getting value into the model

2008-03-07 Thread Kai Mütz
[EMAIL PROTECTED] wrote: Thanks for trying but I get: WicketMessage: No get method defined for class: class java.lang.String expression: state Have you defined a getter/setter for field state in your vendor class? - To

RE: DropDownChoice getting value into the model

2008-03-07 Thread rmattler
Yes @Column(name = state, length = 2) public String getState() { return this.state; } public void setState(String state) { this.state = state; } Kai Mütz wrote: [EMAIL PROTECTED] wrote: Thanks for trying but I get:

Re: DropDownChoice getting value into the model

2008-03-07 Thread Per Newgro
But in java.lang.String there is no state property. You added a list of Strings to the ddc. But you have to add your vendor objects. The display in ddc will be done by ChoiceRenderer. Cheers Per Am Freitag, 7. März 2008 23:34:35 schrieb rmattler: Yes @Column(name = state, length = 2)