MoneyWorks Manual
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.
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.
Validating editable list cells:
Validating a custom edit list column cell from a named validation list
on TweakColumnList:F_TRANS:By_Account:DI(win, list)
AppendColumnToStdEditList(list, "Detail.Custom1", "Custom|60|R")
end
on ValidateCell:F_TRANS:By_Account:Custom(w, i)
return ValidateFieldWithValidationString(w, i, "List:MyValidationList")
end
When using a validation list, you would normally also autocomplete using AutoFillField.
Availability: available within MWScript handlers in v8.1.8 and later. In edit lists from v9.0.1
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