Hi,
Hmmm, I have a simple thing which should be easy but I just cant figure
out on Wicket.
1. I have an input box.
2. I need to "attach" a javascript to this box to monitor key presses.
Basically I need to fire a js on the keyup event.
I've googled but have not found the answer to a basically simple thing.
I've tried the following which I realise wont work since the rendering
should not be into the header (or should it?)
public class KeyPressTagBehavior extends AbstractBehavior
{
private static final long serialVersionUID = 262920170424255562L;
private Component component;
public void bind(Component component)
{
this.component = component;
component.setOutputMarkupId(true);
}
public void renderHead(IHeaderResponse iHeaderResponse)
{
super.renderHead(iHeaderResponse);
iHeaderResponse.renderOnEventJavascript(
component.getMarkupId(),
"keyup",
"alert('Key Up!')");
}
}
Then done a simple
TextField field = new TextField("somefield");
field.add(new KeyPressTagBehavior());
I realised that the renderHead will render into the head. But cant find
a reference in the API to let me add it into the TextField. What is the
correct way to do this?
Regards,
Lester
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org