Validating Input in a Dialog Element

If an input field control or a selection box control is linked to a Natural variable, this dialog element may be checked automatically when it loses the focus to another dialog element in the same dialog. This enables you to validate the end user's input. An input field control or a selection box control will not be checked when the end user clicks on a menu item or switches to another application.

If you specify an edit mask with one of these two dialog elements, the field content is checked against this edit mask plus the Natural data type of the linked variable.

If no edit mask is specified, the field content is checked against the Natural data type only.

There are two ways of specifying an edit mask in an input field control or a selection box control:

The Natural code might look like this:

... 
/* Create an input-field control 
   1 #IF-1 HANDLE OF INPUTFIELD 
... 
/* Assign the Edit Mask 
#IF-1.EDIT-MASK := '999'

Start of instruction setTo specify the edit mask with the dialog editor

  • Open the input field control's attribute window and use the Edit Mask entry.

When the field check fails, a message box comes up where the end user can choose Retry or Cancel. Retry means that the entered text string remains unchanged and can be corrected. Cancel means that the field is reset to the current content of the linked variable.