Setting Out Actions

Creating actions in a FOX module and setting them out on the screen as a link or button.

SYNTAX

The fm:action command takes the following syntax:

<fm:action name=”action-namenamespace:run=”.”/>

The namespace:run attribute tells FOX that the action will be runnable.

The fm:action-out command takes the following syntax:

<fm:action-out action=”action-namenamespace:mode=”.”/>

The action attribute tells FOX what action is to be called when the link or button is clicked. The namespace:mode attribute tells FOX which of the attributes within an action should be used.

CONCEPTS

An action can be declared in the action list for the module, or within a state action list. If it is declared within a state, the action can only be used in that state. A state can see any action that has been declared in the top level action list.

When the action is declared, it must have at least one namespace attributed to it if it is to be set out on the screen. The same principles apply for fm:action-out as they did for fm:set-out.

Fm:action-out is a quick and dirty method of adding actions to the screen. A better way would be to use a function called menu-out which lists all the actions for a given namespace. It can be set to flow down, or across. This will be covered in a later chapter.

A problem with action-out is that you cannot set out an action this way in context of anything; therefore it is a free standing action. The workaround is to use phantoms which are covered in a later chapter.

When using an action-out FOX will put the action on the screen as a hyperlink, this is called a widget. The action widget can be changed to a button using the namespace:widget attribute. This is specified on the action declaration.

EXAMPLES

The following code declares an action that is to be set out on the screen:
<fm:action name=”action-example” fox:run=”.” fox:widget=”button” fox:prompt=”Test”>
   <fm:do>
       [ACTION STUFF]
   </fm:do>
</fm:action>

The presentation code to set the action on the screen would be:

<fm:action-out action=”action-example” fox:mode=”.”/>

The result puts this on the screen:

EXERCISES

Please use your XX_EMPLOYEEMODULE (where XX are your initials) file for the following exercises.

Exercise 1

Create a new action inside state-emp with the name “action-button” and the namespace “empdata”. This action does not have to do anything.

Set-out the action underneath the Employee List.

Exercise 2

Modify the above action to make it a button and add a prompt that says “MyFirst Button”.