Form Functions, Handlers and Signatures
Input Field Function Signatures
Field - Default Function: DEFFUNC
A field level property available on some field types. It must be a function. The function should return the value of the field. Without a default function this would be the defaultValue if currentValue is undefined, otherwise the currentValue.
function(helper, defaultValue, currentValue) {
var theValue;
if (currentValue !== undefined) {
theValue = currentValue;
} else {
theValue = defaultValue;
}
return theValue;
}
Field - Event Handlers: HANDLERS
A field level property available on many field types. It must be a function.
function(helper, fieldName, value, valid, eventName) {
if (eventName == 'CHANGE' && valid) {
// perform action...
}
}
Field - Validation Function: VALFUNC
A field level property available on many field types. It must be a function. The function should return true if the field value is valid, false if it is invalid.
Alternatively, return an object with the keys isValid and errorType to pass custom errors to the error message function.
function(helper, value) {
var isValid = true;
return isValid;
}
Field - Error Message Function: ERRMSGFUNC
Used to generate a custom error message, depending upon the errorType thrown by the field. See Error Message Functions for a full description.
function(helper, errorType, defaultErrorMessage) {
var errorMessage = defaultErrorMessage;
// set error message based on errorType...
return errorMessage;
}
Field - Options Function: OPTIONSFUNC
Used in the radio group, checkbox group, list box and drop-down list field to generate the options displayed.
function(helper, optionData) {
// update optionData...
return optionData;
}