Some behaviors are better to be done at the client side with JavaScript codes, such as animations and image rollovers. In order to execute JavaScript codes at the client, ZK introduces the concept of Client Side Actions (CSA). With CSA, developers could listen to any JavaScript event and executes JavaScript codes at the client.
A CSA is similar to an event listener, except an action is is written in JavaScript and executes at the client. ZK allows developers to specify actions for any JavaScript events, such as onfocus, onblur, onmouseover and onmouseout, as long as your targeting browsers support them.
The syntax of a client-side action is as follows.
action="[onfocus|onblur|onmouseover|onmouseout|onclick|onshow|onhide...]: javascript;"
Notice that CSA is totally independent of ZK event listeners, though they might have the same name, such as onFocus. The differences include:
CSA executes at the client side and takes place, before ZK event listener is called at the server.
CSA codes are written in JavaScript, while ZK event listeners are written in Java.
CSA could register to any event that your targeting browsers allow, while ZK supports events only list in the Events section.