Defining Form Action Events

A form action is a single character that tells the program what action to perform with the data on the form. The action the program performs is called the form action event. The most common form action events are inquiring on a record in a file, adding a record to a file, changing fields on a record, and deleting a record from a file.

In character mode, the first field on every online form is the program code, also called the form ID. The field next to the form ID is the one-character form action field; it is not labeled. The second line on every online form in character mode shows the valid actions for the form.

In GUI mode, the form action is available through a button or a menu option.

On the following Employee Master form, the I action finds (inquires on) and displays the Employee file record for Company 1 and Employee Number 125. The event for the I action is called "Inquire Employee" because I inquires on the Employee file.

When you create a form, the system automatically assigns several action events to the form. The system also assigns a letter or number, which is the action, to each form action event. You can change the assigned action to any unused letter or number. The values assigned to an action must be unique for the events in a particular state.

The system assigns the following inquiry form action events, which access and display records, to all forms.

I Inquire PrimaryFile
N Next PrimaryFile
P Previous PrimaryFile

The system also assigns the following inquiry form action events, which access and display detail file records, to detail forms.

- Page Up DetailFile
+ Page Down DetailFile
X Select Detail DetailFile

During database definition, you can define form action events that update records in a file. For more information on the role of database definition to form action events, see Database Definition. If the form action event is part of the database definition for the primary file, the system assigns the following update form action events to online forms.

A Add Edit PrimaryFile
C Change Edit PrimaryFile
D Delete Edit PrimaryFile

The system does not automatically assign other form action events defined during database definition to a form. You must activate them during form definition. When you paint a form, you can also deactivate form action events that the system assigned to the form.

The following example has six form action events. The system assigns a one-character action to each of these events and activates them (makes each event a valid form action event) for the form. The system then puts valid form action events for the form in the Form Action Events column.

You can deactivate a form action event. When you deactivate a form action event, the system removes it from the Form Action Events column and highlights its counterpart in the FileName Events column, indicating that it is not a valid form action (event) for the form.

If you deactivate the Delete Edit Company form action event on this form, as in the following example, you cannot delete Company file records.

The form action events the system activates when you create a form depends on two things.

  • The kind of form you are defining. For example, the system does not let you define update actions on an inquiry form; therefore, the Add, Change, and Delete actions are not valid on an inquiry form.

  • The events defined for the form's primary and related files during database definition. For example, if the database administrator deletes the Change Edit event for the Company file during database definition, you cannot define a Change Edit Company form action event for a form that updates the Company file.

To define a form action event

  1. On the Format form, press Define (F6) and choose Events.
  2. In the Form Action Definition window, press Insert (F8) to add a form action event.

    The light bar moves to the FileName Events column (where FileName is the primary or detail file).

    From the FileName Events column, select the desired form action event.

    Note: You cannot create a form action event while defining a program; you can only activate or deactivate it. Because form action events are attached to a file, they are created during database definition.
  3. The system adds the event to the Form Action Events column and assigns a one-character action to the event.

    To change the action, type the desired character. Actions for an Add event must be unique within the file; all other actions must be unique within the same state.

  4. Press Enter twice.

    The system makes the changes and returns to the Format form.