synchronise serverside and clientside code

asked 2008-11-13 20:11:35 +0800

huubf gravatar image huubf
69 1

updated 2008-11-13 20:15:28 +0800

I have this:

<button id="openreportbutton" action="onclick:openReport()" onClick="storeChoices()" label="Show Report" />

First the choices are stored in session in a serverside method, than clientside openReport is executed, which does window.open("another.zul") that picks up the values from the session. But storeChoice also checks choosen values.

Now if something was missed, i want to set something in the page, e.g. a label turns to red, and only afterwards first check the color of the value in the javascript function before launching the other zul.

How can i synchronise both calls: so first an Ajax call from ZK, change the labelcolor, then call openReport, to check $("${label.uuid}").getStyle("color")

eh, i see that a short timeout does the trick, but is there an exact method?

<button id="openreportbutton" action="onclick:setTimeout('openReport()',100)" onClick="storeChoices()" label="Show Report" />

Regards, Huub

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2008-11-18 06:20:42 +0800

iantsai gravatar image iantsai
2755 1

I think maybe this will play the trick.

<button id="openreportbutton" label="Show Report">
<attribute name="onClick">

Just use Clients.evalJavaScript("openReport()");

link publish delete flag offensive edit

answered 2008-12-08 13:42:53 +0800

huubf gravatar image huubf
69 1

Great thanks!

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2008-11-13 20:11:35 +0800

Seen: 178 times

Last updated: Dec 08 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More