This function validates the entries in the fields of the orders
screen record.
Function order_validate (orders.4gl):
01 FUNCTION order_validate(d)
02 DEFINE d ui.Dialog
03 IF NOT d.getFieldTouched("orders.*") THEN
04 RETURN TRUE
05 END IF
06 IF d.validate("orders.*") < 0 THEN
07 RETURN FALSE
08 END IF
09 IF NOT order_check_store_num() THEN
10 RETURN FALSE
11 END IF
12 RETURN TRUE
13 END FUNCTION
Note:
- Line 01 The dialog object is passed to this function,
allowing the use of methods of the DIALOG class.
- Lines 03 thru 05 return TRUE to the calling function if the
fields in the orders record have not been touched.
- Lines 06 thru 08 call the validate() method of the dialog
object to execute any NOT NULL, REQUIRED, and
INCLUDE validation rules defined in the form specification
file for the fields in the orders screen record. If this
validation fails, FALSE is returned to the calling
function.
- Lines 09 thru11 call the order_check_store_num function to
verify that the store_num value exists in the
customer database table. If this validation fails,
FALSE is returned to the calling function.
- Line 12 returns TRUE to the calling
function when the validation is successful.