function onChangeTFN(executionContext) {
var formContext = executionContext.getFormContext();
var tfnField = formContext.getAttribute("<yourtfnnumberlogicalname>");
if (tfnField) {
var tfnValue = tfnField.getValue();
if (!validateTFN(tfnValue)) {
formContext.getControl("<yourtfnnumberlogicalname>").setNotification("Invalid TFN number", "Error");
}
}
}
function validateTFN(tfn) {
var tfnRegex = /^\d{3} ?\d{3} ?\d{3}$/;
tfn = tfn.replace(/\s/g, '');
return tfnRegex.test(tfn);
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156