Problem with IHeaderResponse.renderOnEventJavascript

2010-10-13 Thread Carlson Weber
I searched all over the internet and it seems that no one uses this method. The thing is that I am almost thinking that this is a bug, because it's really not logic to me. What I am trying to do: I am creating a panel that I will use in a lot of forms, and I want to attach some javascript code to

Re: Problem with IHeaderResponse.renderOnEventJavascript

2010-10-13 Thread Martin Grigorov
Hi, Indeed it looks this method works only when the target element is already available. It is used by org.apache.wicket.markup.html.internal.HeaderResponse.renderOnDomReadyJavascript(String) and org.apache.wicket.markup.html.internal.HeaderResponse.renderOnLoadJavascript(String) but both of them

Re: Problem with IHeaderResponse.renderOnEventJavascript

2010-10-13 Thread Michael O'Cleirigh
Hello, You can use: textfield.add (new AttributeModifier (onkeydown, true, if (window.event.altKey){if (window.event.keyCode == 80){document.getElementById(' + link.getMarkupId() + ').onclick();}}); If you do this within the Component.onInitialize() you will have the true markupid of the

Re: Problem with IHeaderResponse.renderOnEventJavascript

2010-10-13 Thread Carlson Weber
Ok guys, it worked , I used the AttributeModifier. The thing is, why there's is that renderOnEventJavascript? This should be a method attached maybe to the domready event... Do you think that is worth submiting a patch? Or this is the correct behavior? (IMHO this isn't all right). Anyway, problem