Edit

ValidateFieldWithValidationString (windowRef, itemID, validationDefinition)

Definition:  Call this from a ValidateField handler for a code field to validate the field value against an expression or a validation list. This is a programmatic alternative to setting up a custom validation on the field for each user in the UI.

on ValidateField:F_TRANS:E_USER1(w, f, v)
    return ValidateFieldWithValidationString(w, f, "Expr:_value=`abc@`;must start with abc")
end

on ValidateField:F_TRANS:E_USER2(w, f, v)
    return ValidateFieldWithValidationString(w, f, "List:branches")    // validate against the validation list named branches
end

Note that this only validates the field value on exit; it does not offer autocomplete. To also implement autocomplete, use AutoFillField.

Availability:  available within MWScript handlers in v8.1.8 and later.

In v9.0.1 and later, the itemID may be a list item (or a list handle), in which case this will validate the active cell (if any) of that list. This is particularly useful when you have added custom columns to a list and need to validate them.

See Also:

AutoFillAcctDeptField: Apply auto-complete to a departmental account code edit field

AutoFillField: Apply auto-complete to a code edit field

CheckCodeField: Validate a code edit field