2009/12/17, Pieter Degraeuwe <[email protected]>:
> However, I never do it like this. I always use PropertyModels() to 'map' my
> TextFields to properties of my object. This way your code in the onClick()
> method uses that just the object properties. (Note that the AjaxSubmitLink
> has no onClick(), but a onSubmit()...)
>
> Pieter

Thanks Pieter. I got working this like below:

public class NewLinkPanel extends Panel {
        public NewLinkPanel(String id) {
                super(id);
                add(new LinkForm("linkform"));
        }
}

class LinkForm extends Form {
        
        public LinkForm(String id) {
                super(id);
                
                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) {}                                         
                });
        }

        @Override
        protected void onSubmit() {
                Link l = (Link)this.getModelObject();
                new LinkDAO().save(l);
        }
}


Now i want to update (refresh) my another panel with list of links on my page :D
That will be a problem for me now. I'm beginner....

-- 
Greetings,
marioosh

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to