You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by sdmsec <s_...@yahoo.com> on 2008/05/01 07:36:08 UTC
Re: Updating multiple PropertyModels
Martin Makundi wrote:
>
> Please give me an example:
>
Would the following work for you? It uses a combination of
CompoundPropertyModel and setObjectModel.
class Address {
public String getStreet()...
public void setStreet(String street)...
public String getCity()...
public void setCity(String city)...
}
Form form1 = new Form("form1");
form1.setOutputMarkupId(true);
form1.setModel(new CompoundPropertyModel(someService.getAddress()));
TextField street = new TextField("street");
form1.add(street);
TextField city = new TextField("city");
form1.add(city);
AjaxButton submit = new AjaxButton("submit") {
@Override
protected void onSubmit(AjaxRequestTarget tgt, Form form) {
Address address = (Address)form.getModelObject();
someService.updateAddress(address);
form.setModelObject(someService.getAddress());
tgt.addComponent(form);
};
};
form1.add(submit);
add(form1);
--
View this message in context: http://www.nabble.com/Updating-multiple-PropertyModels-tp16944966p16993026.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Updating multiple PropertyModels
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> Would the following work for you? It uses a combination of
> CompoundPropertyModel and setObjectModel.
> Address address = (Address)form.getModelObject();
> someService.updateAddress(address);
> form.setModelObject(someService.getAddress());
> tgt.addComponent(form);
No. I do not have a simple form. I have multiple listchoicess and
hierarchical listviews.
**
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org