You have to define the "onlyNum" RegExp and the "onlyNumMsg" variables and the "validateField" function as a document level script:var onlyNum = /^\d*$/; var onlyNumMsg = "Please enter only numeric values."; function validateField (getField, getRegex, getAlertMsg) { var fieldFocus = xfa.resolveNode(...