var inputParameters = Duplicate(arguments.parameters); var currentValue = arguments.value; // the field's current value var readOnly = (arguments.displayMode EQ 'readonly') ? true : false; var displayValue = ""; var useCalendarIcon = false; // Get from the App.cfc so all date fields use the same day begin time in their date/time stamp var standardDayBeginTime = application.ptCalendar.getDayBeginTime(); // Set the Time mask to the App standard var cfDateMask = application.ptCalendar.getDisplayCFdateMask(); // Pass new date URL variable through to the Calendar Picker if (StructkeyExists(Request.Params, "newSelectedDate")) currentValue = Request.params.newSelectedDate; if ( LEN(TRIM(currentValue)) ) { // Fix bad or incorrect date/time entries currentValue = application.ptCalendar.date.csDateFormat(currentValue,currentValue); // Strip the standardDayBeginTime from the currentValue and format date for Display displayValue = formatLikePlugin(trim(replace(currentValue, standardDayBeginTime, "", "ALL")), inputParameters.displayFormat); } inputParameters = setDefaultParameters(argumentCollection=arguments); // Set Default Icon Options if ( inputParameters.fldIcon EQ "calendar") useCalendarIcon = true; // plugin js handles rendering it if ( LEN(TRIM(inputParameters.displayFormat)) EQ 0 ) inputParameters.displayFormat = "m/d/yy"; renderJSFunctions(argumentCollection=arguments,fieldParameters=inputParameters,standardDayBeginTime=standardDayBeginTime,useCalendarIcon=useCalendarIcon); disabled="disabled">
Clear Date
var inputParameters = Duplicate(arguments.fieldParameters); var cftDatePickerJS = ''; application.ptCalendar.scripts.addFooterJS(cftDatePickerJS,"TERTIARY"); var inputParameters = Duplicate(arguments.parameters); // Validate if the property field has been defined if ( NOT StructKeyExists(inputParameters, "displayType") OR LEN(inputParameters.displayType) LTE 0 ) inputParameters.displayType = "UIdatepicker"; if ( NOT StructKeyExists(inputParameters, "displayFormat") OR LEN(inputParameters.displayFormat) LTE 0 ) inputParameters.displayFormat = ""; if ( NOT StructKeyExists(inputParameters, "uiTheme") OR LEN(inputParameters.uiTheme) LTE 0 ) inputParameters.uiTheme = application.ptCalendar.getUItheme(); // use the UI theme from the Configuration Element 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, "fldID") OR LEN(inputParameters.fldID) LTE 0 ) inputParameters.fldID = TRIM(arguments.fieldName); else inputParameters.fldID = TRIM(inputParameters.fldID); 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"; } // field types that require some particular minimum height should return the desired number of pixels public numeric function getMinHeight() { return 250; } // formats passed date using a format in the style used by the jQuery UI datepicker plugin function formatLikePlugin(value, format) { var jsTokens = "DD,D,MM,M,YY,Y"; var cfTokens = "dddd,ddd,mmmm,mmm,yyyy,yy"; var cfFormat = replace(arguments.format, "y", "Y", "ALL"); // done this way so y replacement doesn't replace yy result, if you see what I mean cfFormat = replaceList(cfFormat, jsTokens, cfTokens); return dateFormat(arguments.value, cfFormat); } public string function getResourceDependencies() { return listAppend(super.getResourceDependencies(), "jQuery,jQueryUI,DateJS,DateFormat"); } public string function loadResourceDependencies() { // jQuery Headers application.ptCalendar.scripts.loadJQuery(); application.ptCalendar.scripts.loadJQueryUI(themeName=arguments.parameters.uiTheme); // Load the DateJS Plugin Headers application.ptCalendar.scripts.loadDateJS(); // Load the DateFormat Plugin Headers application.ptCalendar.scripts.loadDateFormat(); }