Re: DropDownChoice getting value into the model
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: DropDownChoiceT(String id, IModelT model, IModelListT choices, IChoiceRenrererT 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]
Re: DropDownChoice getting value into the model
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: DropDownChoiceT(String id, IModelT model, IModelListT choices, IChoiceRenrererT 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-tp15905486p16850440.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]
Link and Submit behaviour
Got a question on what the expected behaviours are from a link and a button both of which have their response page set to the same page (onClick onSubmit respectively). I took these form items from the Cheesr example in 'Wicket in Action' and I have used both of these on the second tab on an AjaxTabbedPanel and both response pages set to return to the page containing the tabbed panel. Selecting the link redisplays the tabbed panel showing the first tab. The button, however, displays the second tab. I did attempt a cancel button and this behaved the same as the link but I don't understand why disabling validation and form updating should make a difference. Does anyone have any suggestions as to why there is different behaviour here? public class VxsUserPage extends VxsBasePage { ... public TabPanel2(String id) { super(id); Form form = new Form(form); add(form); form.add(new VxsUserSettingsPanel(userSettings, new Model( VxsUserPage.this.user))); form.add(new Link(cancel) { @Override public void onClick() { setResponsePage(VxsUserPage.class); } }); form.add(new Button(submit) { @Override public void onSubmit() { setResponsePage(VxsUserPage.class); } }); } ... } Regards, Russell -- *VoxSurf Limited* Registered principal office: 2nd Floor Elme House 133 Long Acre London WC2E 9DT United Kingdom Company No (England): 4051448 http://www.voxsurf.com/ Email disclaimer: This can be viewed at http://www.voxsurf.com/disclaimer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]