Type Ahead mechanism details

The idea behind the Type Ahead mechanism is to move the focus to the next field before receiving the answer of the runtime system, and synchronize the user interface once the answer is received.

This mechanism implies that:

The natural field flow

The "natural" field flow is defined by your application. It may depend on the form, on the dialog, on the options (FIELD ORDER) set for the program or the dialog. See the Genero Business Development Language User Guide for more details on how to configure the field flow.

The field order will be transmitted to the browser, which will take care to respect it and synchronize until the answer arrives.

Example

The program is driven by this 4GL code:
DEFINE ad RECORD name, address1, address2, city, st, zipco STRING END RECORD
...
INPUT BY NAME ad.*

Which means that the focus will start in Name, then in the two address fields, city, state and then ZIP code. On a slow network, without Type Ahead mechanism, entering "John Doe" and pressing tab key will display a loading overlay until the answer arrives:


Screen shot showing loading overlay while waiting for validation and return of Full Name.

Figure 1. Loading overlay waiting for field validation to return

With either the HTML5 theme or the Silverlight theme, while waiting for the answer, the focus immediately goes in the next field and let the user fill data. The synchronization will occur when the answer arrives:


Screen shot showing movement into next field (Street Address) while waiting for validation of Full Name to return.

Figure 2. Type Ahead allowing user to continue to work while waiting for field validation

A spinning wheel will be the indicator there currently an out of sync sequence.

Rollback

While waiting for the answer, all actions (focus, change, data, scroll, and so on) are buffered and will be sent immediately after. The action list is then unrolled and each action is sent by the engine to the runtime, whose answers will validate it (see Type Ahead workflows).

In some situations, an action may be invalidated:
  • A NEXT FIELD may change the natural focus flow
  • A field validation (INCLUDE ...) may trigger an error and reset the focus to a specific field
  • UI changes (show / hide fields, OPEN WINDOW ...) may interrupt the natural focus flow
In these situations, the corresponding action and all the remaining ones in the list will be marked as invalid. The client side framework will be notified and will have to "rollback" what has been done by the user and then invalidated.

The user will also be notified (with a visual and sound effect) that something went wrong (see Type Ahead workflows).