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"), networksList);
but the following doesn't....
FormComponent networks = new DropDownChoice("network", new
BoundCompoundPropertyModel(phone), networksList);
I've tried stepping into the code but can't resolve the issue. Can anyone
confirm or explain this problem?
Russell Webb wrote:
>
> 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.
>
> CompoundPropertyModel$AttachedCompoundPropertyModel(AbstractPropertyModel).setObject(Object)
> line: 146
> TextField(Component).setModelObject(Object) line: 2888
> TextField(FormComponent).updateModel() line: 1060
> Form$19.validate(FormComponent) line: 1754
>
> Submitting the dropdown acquires the read only setObject()
> VxsNewUserWizard$3(AbstractReadOnlyModel).setObject(Object) line: 52
> BoundCompoundPropertyModel(CompoundPropertyModel).setObject(Object)
> line: 72
> DropDownChoice(Component).setModelObject(Object) line: 2888
> DropDownChoice(FormComponent).updateModel() line: 1060
> Form$19.validate(FormComponent) line: 1754
>
> It seems the model is linked to the two components differently and that
> this causes different behaviour when using a CompoundPropertyModel (and
> perhaps others) like allowing the ReadOnlyModel.setObject to be bypassed.
>
> Russ
>
>
>
> igor.vaynberg wrote:
>>
>> 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 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
>>> model. I'm trying to get the selected value stored into the Vendor
>>> object
>>> and a String not a SelectOption.
>>>
>>> public class Vendor implements java.io.Serializable {
>>>
>>> private String state;
>>>
>>>
>>>
>>>
>>>
>>> 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:
>>>
>>> DropDownChoice<T>(String id, IModel<T> model, IModel<List<T>> choices,
>>> IChoiceRenrerer<T> renderer)
>>>
>>> -igor
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/DropDownChoice-getting-value-into-the-model-tp15905486p15907046.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-getting-value-into-the-model-tp15905486p16927437.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]