-
FEATURED COMPONENTS
First time here? Check out the FAQ!
The following page is not rendered at all.
<zk> <script type="text/JavaScript"> <![CDATA[ function doSomething(txtTest) { var value = txtTest.value; } ]]> </script> <window> <textbox id="txtTest" value="test" onChange="alert(self.getValue());" visible="false"/> <button id="btnTest" label="call js function" action="onclick:doSomething(#{txtTest})"/> </window> </zk>
It seems that the
action="onclick:doSomething(#{txtTest})"
Thank you all
/costas
which zk version?
Hmmm, i mean '<button action=' is not right
try it with the <button onClick=""
Thanks Stephan but no luck. I'm not sure what's the problem. Is the 'action' attribute deprecated?
/costas
Costas,
The action attribute in Client-Side Action is not depreciated but it has changed from how it worked in ZK 3.x. Whereas in ZK 3 the action could take just about any onXXXX event, In ZK5 it is used mainly for "show", "hide", and "invalidate" operations.
For more information about CSA, you can go here.
If you want to call JavaScript from your zul there are a couple of ways that I do it:
Namespace
<zk xmlns:w="http://www.zkoss.org/2005/zk/client"> <script> function test(){ alert("Hello from JavaScript"); } </script> <window> <button id="btnTest" label="call JS function" w:onClick="test()"/> </window> </zk>
Java call
<zk> <script> function test(){ alert("Hello from JavaScript"); } </script> <window> <button id="btnTest" label="call JS function"> <attribute name="onClick"> String jsCommand = "test()"; Clients.evalJavaScript(jsCommand); </attribute> </button> </window> </zk>
Hope that helps,
Todd
Now it is clear.
Thank you very much for your time Todd.
/costas
Asked: 2011-08-23 04:51:53 +0800
Seen: 632 times
Last updated: Aug 24 '11