validate() is used to check the values input to the form fields:
CALL DIALOG.validate("field_list")
The method checks the values according to the parameters specified in INCLUDE, NOT NULL and REQUIRED field attributes. The method returns 0 if the values satisfy all the requirements, otherwise, it returns an error code of the first field which does not.
If an error occurs when validate() is executed, the program performance does not stop. Instead, a corresponding error message occurs and the program finds the next field to where the cursor will move after the program control returns to the interactive process.
There is some specifics about using variables with ui.Dialog methods.
You can learn about them here.