UI actions are generally considered to be a server-side script, but they can also run as client-side script, too. We will cover an introduction to UI actions and their basic usage in the server-side basics in the next chapter. Here, though, we will look at the more advanced techniques of running UI actions on the client side.
To change a UI action to run client-side script, we first need to check the client field tick box. This brings up some additional fields, including the checkboxes to select which list versions the UI actions will be compatible with, but the main new field we are interested in is called onClick
.
The onClick
field runs the client code contained inside it when the UI action is selected. Visually, this is only a small field, and not that appropriate for code, so most developers call a function in this field and define the function in the main script field.
Let's look at an example of this usage. For the code in the onClick
field, we only need...