var inputParameters = application.ADF.data.duplicateStruct(arguments.parameters);
var currentValue = arguments.value; // the field's current value
var readOnly = (arguments.displayMode EQ 'readonly') ? true : false;
var displayValue = "";
var useCalendarIcon = false;
var cftHeaderCSS = '';
var cftClearDateLinkCSS = '';
// Pass new date URL variable through to the Calendar Picker
if ( StructKeyExists(request.params,"newSelectedDate") )
currentValue = request.params.newSelectedDate;
inputParameters = setDefaultParameters(argumentCollection=arguments);
if ( LEN(TRIM(currentValue)) ){
// Fix bad or incorrect date/time entries
currentValue = application.ADF.date.csDateFormat(currentValue,currentValue);
// Strip the standardizedTimeStr from the currentValue and do a DateForamt for Display
displayValue = DateFormat(TRIM(REPLACE(currentValue,inputParameters.standardizedTimeStr,"","all")),inputParameters.cfDateMask);
}
// Set Default Icon Options
if ( inputParameters.fldIcon EQ "calendar")
useCalendarIcon = true;
renderJSFunctions(argumentCollection=arguments, fieldParameters=inputParameters,useCalendarIcon=useCalendarIcon);
// After JS functions are rendered then handle the HTML the Calendar Icon image rendering
if (inputParameters.displayType EQ "UIdatepicker")
useCalendarIcon = false;
application.ADF.scripts.addHeaderCSS(cftClearDateLinkCSS,"TERTIARY");
application.ADF.scripts.addHeaderCSS(cftHeaderCSS,"TERTIARY");
var inputParameters = application.ADF.data.duplicateStruct(arguments.fieldParameters);
var bUseCalendarIcon = arguments.useCalendarIcon;
var cftDatePickJS = '';
var yearRangeStr = inputParameters.yearRangeStart & ":" & inputParameters.yearRangeEnd;
application.ADF.scripts.addFooterJS(cftDatePickJS,"TERTIARY");
var inputParameters = application.ADF.data.duplicateStruct(arguments.parameters);
// inputParameters fields that cannot be overridden by the App
var inputParametersExceptionsList = "fldID,appBeanName,appPropsVarName";
// Validate if the property field has been defined
if ( NOT StructKeyExists(inputParameters, "fldID") OR LEN(inputParameters.fldID) LTE 0 )
inputParameters.fldID = TRIM(arguments.fieldName);
else
inputParameters.fldID = TRIM(inputParameters.fldID);
if ( NOT StructKeyExists(inputParameters, "uiTheme") OR LEN(inputParameters.uiTheme) LTE 0 )
inputParameters.uiTheme = "ui-lightness";
if ( NOT StructKeyExists(inputParameters, "displayType") OR LEN(inputParameters.displayType) LTE 0 )
inputParameters.displayType = "UIdatepicker";
if ( NOT StructKeyExists(inputParameters, "fldIcon") OR LEN(inputParameters.fldIcon) LTE 0 )
inputParameters.fldIcon = "none";
if ( NOT StructKeyExists(inputParameters, "fldClearDate") OR LEN(inputParameters.fldClearDate) LTE 0 )
inputParameters.fldClearDate = "no";
if ( NOT StructKeyExists(inputParameters, "fldIconImg") OR LEN(inputParameters.fldIconImg) LTE 0 )
inputParameters.fldIconImg = "/ADF/extensions/customfields/date_picker/ui_calendar.gif";
if ( NOT StructKeyExists(inputParameters, "standardizedTimeType") OR LEN(inputParameters.standardizedTimeType) LTE 0 )
inputParameters.standardizedTimeType = "start";
// Default: for start dates: 00:00:00 - Option: for end dates use: 23:59:59
if ( NOT StructKeyExists(inputParameters, "standardizedTimeStr") OR LEN(inputParameters.standardizedTimeStr) LTE 0 )
inputParameters.standardizedTimeStr = "00:00:00";
if ( NOT StructKeyExists(inputParameters, "jsDateMask") OR LEN(inputParameters.jsDateMask) LTE 0 )
inputParameters.jsDateMask = "m/d/yy";
if ( NOT StructKeyExists(inputParameters, "cfDateMask") OR LEN(inputParameters.cfDateMask) LTE 0 )
inputParameters.cfDateMask = "M/D/YYYY";
if ( NOT StructKeyExists(inputParameters,"yearRangeStart") OR LEN(inputParameters.yearRangeStart) LTE 0 )
inputParameters.yearRangeStart = "c-10";
if ( NOT StructKeyExists(inputParameters,"yearRangeEnd") OR LEN(inputParameters.yearRangeEnd) LTE 0 )
inputParameters.yearRangeEnd = "c+10";
//-- App Override Variables --//
if ( NOT StructKeyExists(inputParameters, "appBeanName") OR LEN(inputParameters.appBeanName) LTE 0 )
inputParameters.appBeanName = "";
if ( NOT StructKeyExists(inputParameters, "appPropsVarName") OR LEN(inputParameters.appPropsVarName) LTE 0 )
inputParameters.appPropsVarName = "";
// Optional ADF App Override for the Custom Field Type inputParameters
If ( LEN(TRIM(inputParameters.appBeanName)) AND LEN(TRIM(inputParameters.appPropsVarName)) ) {
inputParameters = application.ADF.utils.appOverrideCSParams(
csParams=inputParameters,
appName=inputParameters.appBeanName,
appParamsVarName=inputParameters.appPropsVarName,
paramsExceptionList=inputParametersExceptionsList
);
}
return inputParameters;
private any function getValidationJS(required string formName, required string fieldName, required boolean isRequired)
{
if (arguments.isRequired)
return 'hasValue(document.#arguments.formName#.#arguments.fieldName#, "TEXT")';
return "";
}
private string function getValidationMsg()
{
return "Please select a value for the #arguments.label# field.";
}
private boolean function isMultiline()
{
return structKeyExists(arguments.parameters, "fldClearDate") && arguments.parameters.fldClearDate == "yes";
}
/*
IMPORTANT: Since loadResourceDependencies() is using ADF.scripts loadResources methods, getResourceDependencies() and
loadResourceDependencies() must stay in sync by accounting for all of required resources for this Custom Field Type.
*/
public void function loadResourceDependencies()
{
var inputParameters = application.ADF.data.duplicateStruct(arguments.parameters);
inputParameters = setDefaultParameters(argumentCollection=arguments);
// Load registered Resources via the ADF scripts_2_0
application.ADF.scripts.loadJQuery(noConflict=true);
application.ADF.scripts.loadJQueryUI(themeName=inputParameters.uiTheme);
// Load the DateJS Plugin Headers
application.ADF.scripts.loadDateJS();
// Load the DateFormat Plugin Headers
application.ADF.scripts.loadDateFormat();
// Load the UI Date Picker Plugin Headers
if ( inputParameters.displayType EQ "datepick" )
application.ADF.scripts.loadJQueryDatePick();
}
public string function getResourceDependencies()
{
return "jQuery,jQueryUI,DateJS,DateFormat,JQueryDatePick,jQueryUIDefaultTheme";
}