enableLogging = false; // set to true for debug logging dumpLogFileName = "_ptCalendar_inc-pre-save-form-hook.html"; errorLogFileName = "_ptCalendar_inc-pre-save-form-hook-error.html"; if ( enableLogging ) { try { application.ADF.log.logAppend(msg=attributes, label='attributes pre save form hook', logfile=dumpLogFileName); } catch ( any expt ) { WriteDump(expt); } } // Init PRE-save-form-hook vars preDataCompare = StructNew(); preDataSame = false; preNewRecord = false; preAbort = false; elemtID = ''; outputStruct = {}; dataPageID = 0; newCSPageID = 0; // Set a request.preSaveFormHook variable that is shared with the post-save-form-hook if ( NOT StructKeyExists(request,'preSaveFormHook') ) request.preSaveFormHook = {}; request.preSaveFormHook.runPostSaveHook = true; try { if ( StructKeyExists(attributes,'inputStruct') ) { if( enableLogging ) application.ADF.utils.logAppend(msg=attributes.inputStruct, label='attributes.inputStruct', logfile=dumpLogFileName); // Set the Element ID from the formID or the controlTypeID if ( StructKeyExists(attributes.inputStruct, 'controlTypeID') ) elemtID = attributes.inputStruct.controlTypeID; else if ( StructKeyExists(attributes.inputStruct, 'FormID') ) elemtID = attributes.inputStruct.FormID; // Set the Data Page ID from the dataPageID or the PageID if( StructKeyExists(attributes.inputStruct, 'dataPageID') ) dataPageID = attributes.inputStruct.dataPageID; else if( StructKeyExists(attributes.inputStruct, 'savePageID') ) dataPageID = attributes.inputStruct.savePageID; else if( StructKeyExists(attributes.inputStruct, 'PageID') ) dataPageID = attributes.inputStruct.pageid; else dataPageID = 0; // Copy the inputStruct to the outputStruct outputStruct = Duplicate( attributes.inputStruct ); // Calendar Event Details ceFormName = 'Calendar Event Details'; ceFormID = application.ADF.cedata.getFormIDByCEName(CEName=ceFormName); /* if ( elemtID EQ ceFormID ) { // Get ID fieldID and build the FIC name kwFldName = 'keywords'; kwFldId = application.ADF.fields.getCEFieldId(ceNameOrID=elemtID,fieldName=kwFldName); kwFIC = 'FIC_#elemtID#_#kwFldId#'; // Get The Value for Keywords Field kwValue = ''; kwArr = []; kwItm = ''; kwArrB = []; if ( StructKeyExists(outputStruct,kwFIC) ) kwValue = outputStruct[kwFIC]; if ( TRIM(kwValue) NEQ '' ) { kwArr = listToArray(kwValue,','); // Loop over each keyword and remove any leading and trailing spaces for ( k=1; k <= ArrayLen(kwArr); k++ ) { kwItm = TRIM(kwArr[k]); ArrayAppend(kwArrB,kwItm); } outputStruct[kwFIC] = arrayToList(kwArrB,','); // copy modified args into caller scope caller.retStruct.requestparams = outputStruct; } } */ // END: ceFormName: keywords fix } } catch (any excpt) { application.ADF.utils.logAppend(msg=excpt, label='ptCalendar-Pre-Save-Error', logfile=errorLogFileName); rethrow; }