use an attribute modifier.

you can get the component to print out its id by calling Component.setOutputMarkupId(true).
then add an attribute modifier that adds _javascript_ to the onclick event.

-Igor


On 3/10/06, Karl-Erik Rønsen <[EMAIL PROTECTED]> wrote:

When attaching a _javascript_ function event handler to some element in a
static html page i would do this...

document.getElementById( "myButton" ). {
    // do stuff
}

... for some HTML like this ...

<input type="button" id="myButton" value="Click me!" />

When creating a custom component with Panel, i cant attach event handlers
this way when the  component will be used multiple times in one page, as the
HTML element id would be duplicated.

What is the best way to attach event handlers to HTML elements in
components, avoiding the problem described?

Thanks in advance.

Karl-Erik




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to