Place your textfields in a Form. Replace your AjaxLink() by a AjaxSubmitLink
(and place that link also in the form)
then, you should be able to get the values by name.getDefaultModelObject() I
think...

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

On Thu, Dec 17, 2009 at 8:45 AM, marioosh.net <[email protected]>wrote:

> Is simple possibility to access page components in anonymous onClick
> method like in code below ?
>
> public class NewLinkPanel extends Panel {
>        public NewLinkPanel(String id) {
>                super(id);
>
>                TextField name = new TextField("name");
>                TextField address = new TextField("address");
>                add(name);
>                add(address);
>                add(new AjaxLink("ok"){
>                public void onClick(AjaxRequestTarget target) {
>                        // how to get name and address values ?
>                        System.out.println("ok");
>            }
>                });
>        }
> }
>
> Thanks in advance.
>
> --
> Greetings,
> marioosh
>
> ---------------------------------------------------------------------
> 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

Reply via email to