AFTER FIELD field CALL field_valid(field) RETURNING ok, error_text IF NOT ok THEN ERROR error_text NEXT FIELD field END IF ...FUNCTION field_valid(l_value)DEFINE l_value STRING IF l_value IS NULL THEN RETURN FALSE, %"Error.Field.Entered" END IF IF l_value.getLength() <=3 THEN RETURN FALSE, %"Error.Field.MinLength" END IF RETURN TRUE, ""END FUNCTION
AFTER FIELD field CALL field_valid(field) RETURNING ok, error_text IF NOT ok THEN ERROR error_text NEXT FIELD field END IF ... [/quote]You have to add the call to field_valid() in AFTER INPUT. Otherwise any field not being touched in the dialog would be accepted unvalidated. For a while we suggested the trigger ON VALIDATE. This trigger would be called whenever the dialog must validate a field (AFTER FIELD, AFTER INPUT, before calling a action). This little enhancement would make your code more readable (my point of view) and reduce the duplication of the validation code.
AFTER FIELD field CALL field_valid(field) RETURNING ok, error_text IF NOT ok THEN ERROR error_text NEXT FIELD field END IF ...