/* * AutoIssueDate: This script update the issue date to the current date in the format DD/MM/YYYY * By: Davis Carlson - July 25st, 2022 * * Input Fields: - Issue Date * * Invariants: None */ var tc_event; changeValue(TC_Event); function changeValue(TC_Event) { var tcData = JSON.parse(TC_Event); var indexIssueDate = getFieldIndex(tcData, 'name', 'Issue Date'); var today = new Date(); var dd = today.getDate(); var mm = today.getMonth() + 1; var yyyy = today.getFullYear(); tcData[indexIssueDate]['value'] = dd + '/' + mm + '/' + yyyy; tc_event = JSON.stringify(tcData); return tc_event; } /* Returns the index of a field based on its property and value, usually name */ /* Example: var indexTextField1 = getFieldIndex(inputParsed, 'name', 'DOB'); */ function getFieldIndex(fields, prop, value) { for (var i in fields) { if (fields[i][prop] === value) return i; } return -1; } ############################ To unsubscribe from the NACCU-L list: write to: mailto:NACCU-L-SIGNOFF-REQUEST@LISTSERV.JMU.EDU or click the following link: http://listserv.jmu.edu/cgi-bin/wa?SUBED1=NACCU-L&A=1