class LinkForm extends Form {
private AddLinkCallback callback;
public LinkForm(String id, *final *AddLinkCallback callback) {
super(id);
this.callback = callback;
*final *Link link = new Link();
this.setModel(new Model(link));
add(new TextField("name", new PropertyModel(link, "name")));
add(new TextField("address",new PropertyModel(link,
"address")));
add(new AjaxSubmitLink("ok"){
@Override
protected void onSubmit(AjaxRequestTarget target,
Form form) {
*new LinkDAO().save(l)*;
callback.onAdd(target);
}
});
}
@Override
protected void onSubmit() {
System.out.println("ok");
Link l = (Link)this.getModelObject();
new LinkDAO().save(l);
callback.onAdd(target ????); // ???????????????????????????
}
}
On Thu, Dec 17, 2009 at 3:02 PM, marioosh.net <[email protected]>wrote:
>
>
>
> Pieter Degraeuwe wrote:
> >
> > I don't have the habit to exend from Form, since I don't need to put
> logic
> > there (I put it in my submitLinks/buttons)
> >
> > On Thu, Dec 17, 2009 at 2:45 PM, Pieter Degraeuwe <
> > [email protected]> wrote:
> >
> >> Use the onSubmit(AjaxRequestTarget target) of your AjaxSubmitLink
> instead
> >> of your form.
> >> (Note that if you make use of FeedbackPanel, youd should also override
> >> the
> >> onError() method of that ajaxlink to 'refresh' your feedback panel)
> >>
> >
>
> At first I wanted to do this in onSubmit of AjaxSubmitLink, but i've
> problem
> to get name and address components inside this method :(
>
> --
> View this message in context:
> http://old.nabble.com/Accessing-Page-components-tp26824375p26828432.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]
>
>
--
Pieter Degraeuwe
Systemworks bvba
Belgiƫlaan 61
9070 Destelbergen
GSM: +32 (0)485/68.60.85
Email: [email protected]
visit us at http://www.systemworks.be