Dear all,

I try to show and focus on a text field when clicking on a link. The focus however doesn't work. I tried to follow an example in cwiki (http://cwiki.apache.org/WICKET/calling-javascript-function-on-wicket-components-onclick.html) but I somehow do something wrong. I tried to add some javascript attribute via AttributeAppender, but then I get a null pointer exception in onClick ("target is null"). When I comment that line out (so don't add the Attribute), everything works fine except that focus doesn't work.

Any help appreciated.
Thanks a lot
Philipp

Here's my code:

in a WebMarkupContainer:
link.add(new AttributeAppender("onClick", new Model("getElementById('"+textfield.getMarkupId()+ "').onFocus();"), ";"));

in my custom Link Class:
public void onClick(AjaxRequestTarget target)
       {
           showFormThatContainsTextField(target);
}

void showFormThatContainsTextField(AjaxRequestTarget target)
   {
       // toggle the visibility
        ...
       // redraw the add container.
       target.addComponent(this);
   }

--

Averbis GmbH
c/o Klinikum der Albert-Ludwigs-Universität
Stefan-Meier-Strasse 26
D-79104 Freiburg

Fon: +49 (0) 761 - 203 6707
Fax: +49 (0) 761 - 203 6800
E-Mail: dau...@averbis.de

Geschäftsführer: Dr. med. Philipp Daumke, Kornél Markó
Sitz der Gesellschaft: Freiburg i. Br.
AG Freiburg i. Br., HRB 701080


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to