Home   Single Page

Client Side Actions

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: