Open

Validate field input value without using a default/layout/trigger

  • 17 October 2019
  • 0 replies
  • 44 views

Userlevel 5
Badge +6

If we want to check a field on a valid input value (and prevent saving) we need to create a default, a layout and a trigger procedure.

We regularly use a combination of a default + trigger because the user will see an error message as early as possible and the trigger would prevent the insert the record.

  • The default will validate the field after leaving it (@cursor_from_col_id) and return an error message.
  • The trigger will also validate the field with the same code (but with the inserted of course).

There’s a problem with this combination when a user fills in the field and saves the form without leaving the field first. In this case the error message (see screenshot below) will be shown twice. Once for the default and once for the trigger.

 

A solution could be to add a layout procedure that also validates the field with (again) the same code. The layout procedure could disable the save button when it determines that the field value is incorrect. But this result in a default, layout and a trigger with the same validation check. Not exactly low code.


What if the TSF offers a field validation option? A screen to create one or multiple validations per field. It could range from simple checks like: field is empty, field value must be unequal to 0 or the option the add a query. We could also add a desired result to a configured field validation like showing an error message or placing a conditional layout.

These new field validations need to be executed in the GUI before saving/inserting a record and could act as a default because the validation is linked to a field.  They can also be used for dynamically creating the validation within triggers.


0 replies

Be the first to reply!

Reply