Hello,
1- I saw on documentation that a field can be reached using the ‘context’ parameter (e.g. context.New.Phone) or by the ‘five’ parameter (e.g. five.field.Phone).
What is the difference between them, and what is the best to use ?
2- What paramater should I use if I want the value of the ‘current field’ when the function is called from an Events thrown by a Form-field (e.g field On validate)?
For example, I have many telephone number fields and I want to re-use the same function for these fields (HomePhone, PrivateMobile, BusinessMobile). In the following JS function, what should I write instead of [currentFieldValue]:
Function validatePhone (five, context, result) {
let telephone = [currentFieldValue];
if (telephone.length !== 10 && telephone.length !== 0) {
return five.createError(result, 'Phone must be 10 digits');
}
return five.success(result);
}