-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I'm working on a regular JSP that I would like to integrate with a zul component.
I added a zk button using JSP tags, but what I need is to call the handler of that button from javascript.
i.e.: The zk script called when I click that button should also be called when the user click a legacy html button.
The technique I used untile before zk 3.5.0 was to enclose the zk button inside a custom div with an ID I know, so to get it via javascript, get the button inside it and then simulate the click creating the event.
But now, with zk 3.5.0 the html code generated for the button is completely different (and much more complitaded) than before, so: is there another, more clean, technique to reach this goal?
Thanks for any hints,
Alex
The new button actually embedded a HTML button inside. If the button's UUID is "z_123", the the embedded HTML button is "z_123!real".
In addition to enclosing a custom div, you might consider to generate a map of ID to UUID in JavaScript:
//foo.jsp
<script language="javascript">
uuidmap = {};
uuidmap['${btn.id}'] = uuidmap['${btn.uuid}'];
</script>
Then, in JavaScript, you can get the element by use of $e(uuidmap + "!real").
It might not be better than your custom-div approach. Just to give you 2nd opinion.
Tom
Hello Tom, and thanks for your reply.
Unfortunately I'm unable to understand your suggestion: the problem being that I'm unable to know the id of the zk button in advance.
For example, in my case, in the zk code it has id "myButton", but in HTML is ID is "z_c3_1", and each time I refresh the page the id changes.
Having the option to know in advance the ID name of the html button or, better, leave it with the name I assigned it, would be a very welcome thing!
Thanks,
Alex
btn.getUuid() is the id show on the browser HTML. And the inner HTML button's id on the browser would be btn.uuid()+"!real".
e.g. the "z_c3_1" is the uuid of the button and the inner HTML button's id would be "z_c3_1!real" on browser.
You can check the Browser source code to find it.
And theoretically, you can use EL to "remember" the btn's uuid and so on.
Asked: 2008-09-26 10:24:20 +0800
Seen: 845 times
Last updated: Oct 02 '08