function isBrowserOffline(){ // returns TRUE if the browser is running Prophet in offline (DOLS) mode if (window.location.hostname.toLowerCase() == "localhost" || window.location.hostname == "127.0.0.1") { return true; } else { return false; } } //----------------------------------------------------------------------------------- //similar to parseFloat(), mParseFloat returns NaN if the number passed in is empty otherwise it converts the prophetSampleFormatEntryNumber's decimal separator to determine . and returns the number (parseFloat always needs ".") //this means it can be used interchangeably with US-formatted or locale-formatted numbers. //----------------------------------------------------------------------------------- function mParseFloat(value){ //variables var n = 0/0; //quick way to get NaN //grab the prophetSampleFormatEntryDate value on the page to check against var prophetSampleFormatEntryNumber = document.getElementById("prophetSampleFormatEntryNumber"); if (prophetSampleFormatEntryNumber == null) {alert("Warning: prophetSampleFormatEntryNumber object not found. \n\n Validation cannot continue.");return n;} var s = new String(prophetSampleFormatEntryNumber.value); // var s = "ii.fff"; //Step 1 determine our delimiter var strDelimiter; strDelimiter = s.replace(/i/g,""); strDelimiter = strDelimiter.replace(/f/g,""); //Step 2 grab the value, replace decimal with . and parseFloat it var st = new String(value); if(st=='')return n; if (strDelimiter != ".") st = st.replace(RegExp(strDelimiter), "."); return(parseFloat(st)); } // COOKIE FUNCTIONS /** * This is the Cookie() constructor function. * * This constructor looks for a cookie with the specified name for the current document. If one exists, it parses its value into a set of * name/value pairs and stores those values as properties of the newly created object. * * To store new data in the cookie, simply set properties of the Cookie object. Avoid properties named "store" and "remove" since these are * reserved as method names. * * To save cookie data in the web browser's local store, call store(). * To remove cookie data from the browser's store, call remove(). * * The static method Cookie.enabled() returns true if cookies are enabled and returns false otherwise. */ function Cookie(name) { this.$name = name; // Remember the name of this cookie // First, get a list of all cookies that pertain to this document. We do this by reading the magic Document.cookie property If there are no cookies, we don't have anything to do. var allcookies = document.cookie.replace(/; /g, ";"); if (allcookies == "") return; // Break the string of all cookies into individual cookie strings, then loop through the cookie strings, looking for our name var cookies = allcookies.split(';'); var cookie = null; for(var i = 0; i < cookies.length; i++) { // Does this cookie string begin with the name we want? if (cookies[i].substring(0, name.length+1) == (name + "=")) { cookie = cookies[i]; break; } } // If we didn't find a matching cookie, quit now if (cookie == null) return; // The cookie value is the part after the equals sign var cookieval = cookie.substring(name.length+1); // Now that we've extracted the value of the named cookie, we must break that value down into individual state variable // names and values. The name/value pairs are separated from each other by ampersands, and the individual names and values are // separated from each other by colons. We use the split() method to parse everything. var a = cookieval.split('&'); // Break it into an array of name/value pairs for(var i=0; i < a.length; i++) // Break each pair into an array a[i] = a[i].split(':'); // Now that we've parsed the cookie value, set all the names and values as properties of this Cookie object. Note that we decode the property value because the store() method encodes it for(var i = 0; i < a.length; i++) { this[a[i][0]] = decodeURIComponent(a[i][1]); } } /** * This function is the store() method of the Cookie object. * * Arguments: * * daysToLive: the lifetime of the cookie, in days. If you set this to zero, the cookie will be deleted. If you set it to null, or * omit this argument, the cookie will be a session cookie and will not be retained when the browser exits. This argument is used to * set the max-age attribute of the cookie. * path: the value of the path attribute of the cookie * domain: the value of the domain attribute of the cookie * secure: if true, the secure attribute of the cookie will be set */ Cookie.prototype.store = function(daysToLive, path, domain, secure) { // First, loop through the properties of the Cookie object and put together the value of the cookie. Since cookies use the // equals sign and semicolons as separators, we'll use colons and ampersands for the individual state variables we store // within a single cookie value. Note that we encode the value of each property in case it contains punctuation or other // illegal characters. var cookieval = ""; for(var prop in this) { // Ignore properties with names that begin with '$' and also methods if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function') || prop == '') continue; if (cookieval != "") cookieval += '&'; cookieval += prop + ':' + encodeURIComponent(this[prop]); } // Now that we have the value of the cookie, put together the complete cookie string, which includes the name and the various attributes specified when the Cookie object was created var cookie = this.$name + '=' + cookieval; if (daysToLive || daysToLive == 0) { // cookie += "; max-age=" + (daysToLive*24*60*60); <- removed this since IE doesn't honor it and replaced with the 'expires' code below var theDate = new Date(); var dateInMilliseconds = theDate.getTime(); dateInMilliseconds = dateInMilliseconds + (1000*60*60*24*daysToLive); theDate.setTime(dateInMilliseconds); cookie += "; expires=" + (theDate.toGMTString()); } if (path) cookie += "; path=" + path; if (domain) cookie += "; domain=" + domain; if (secure) cookie += "; secure"; // Now store the cookie by setting the magic Document.cookie property document.cookie = cookie; } /** * This function is the remove() method of the Cookie object; it deletes the properties of the object and removes the cookie from the browser's local store. * * The arguments to this function are all optional, but to remove a cookie you must pass the same values you passed to store(). */ Cookie.prototype.remove = function(path, domain, secure) { // Delete the properties of the cookie for(var prop in this) { if (prop.charAt(0) != '$' && typeof this[prop] != 'function') delete this[prop]; } // Then, store the cookie with a lifetime of 0 this.store(0, path, domain, secure); } /** * This static method attempts to determine whether cookies are enabled. It returns true if they appear to be enabled and false otherwise. * A return value of true does not guarantee that cookies actually persist. Nonpersistent session cookies may still work even if this method returns false. */ Cookie.enabled = function() { // Use navigator.cookieEnabled if this browser defines it if (navigator.cookieEnabled != undefined) return navigator.cookieEnabled; // If we've already cached a value, use that value if (Cookie.enabled.cache != undefined) return Cookie.enabled.cache; // Otherwise, create a test cookie with a lifetime document.cookie = "testcookie=test; max-age=10000"; // Set cookie // Now see if that cookie was saved var cookies = document.cookie; if (cookies.indexOf("testcookie=test") == -1) { // The cookie was not saved return Cookie.enabled.cache = false; } else { // Cookie was saved, so we've got to delete it before returning document.cookie = "testcookie=test; max-age=0"; // Delete cookie return Cookie.enabled.cache = true; } } // ONLOAD() FUNCTIONS // Used by forms that appear in the Workspace Frame, so that their appropriate HeaderFrame content gets displayed. // Call this function in the onLoad() event of the form. function wsOnLoad() { /* if (top.HeaderFrame == null) return true; if (document.forms[0].jsOnLoadURL == null) return true; if (document.forms[0].jsOnLoadURL.value == "") return true; newPathname = top.HeaderFrame.location.pathname.slice(0, top.HeaderFrame.location.pathname.lastIndexOf("/") + 1); newURL = top.HeaderFrame.location.protocol + "//" + top.HeaderFrame.location.host + newPathname + document.forms[0].jsOnLoadURL.value + "&Arg1=" + document.forms[0].jsArg1.value + "&Arg2=" + document.forms[0].jsArg2.value + "&Arg3=" + document.forms[0].jsArg3.value + "&Arg4=" + document.forms[0].jsArg4.value + "&NBColor=" + document.forms[0].jsNBColor.value; if (getBrowserName != "Notes") { if (top.HeaderFrame.location.href != newURL) top.HeaderFrame.location.replace(newURL); }; return true; */ } //Placed in the onLoad() of forms. Launches forced help, begins anti-timeout windows, etc. Passed the form version for future branching logic. function shopOnLoad(formVersion) { if (formVersion == 5) { var formID=document.forms[0].jsFormID; if (formID) { //only run in edit mode checkForcedHelp(formID.value); //code = 'window.open(document.forms[0].jsDefinitionsDbURL.value + \"/EmptyPage?OpenPage\", \"blank\", \"WIDTH=10, HEIGHT=10\"); window.focus(); setTimeout(code, 1800000);'; //execute ajax (asynchronous) page load ever 4 minutes (need the random piece or IE6 won't reload) code = 'dojo.xhrGet({ url : document.forms[0].jsDefinitionsDbURL.value + "/EmptyPage?OpenPage&" + Math.random(), sync: false ,load : function (response) {return(true);},error : function (response){ return(true);}}); setTimeout(code, 240000); '; setTimeout(code, 240000); } } return(true); } // this code prevents CR/LF and BACKSPACE from firing on forms (causing navigation/submission to occur) // it also prevents CR/LF in a text box from causing submission (IE/FF do this if there's only one on the screen, Safari does it always) // simply add it to the onKeyDown event of a form, and call by: return(checkKeys(event)); function checkKeys(theEvent) { var kc = theEvent.keyCode; var tgt =theEvent.srcElement ? theEvent.srcElement : theEvent.target; // if they pressed something besides CR/LF/BS or we're in a textarea, assume OK. if ((kc != 13 && kc != 10 && kc != 8) || tgt.type == "textarea") return true; // the various inputs: make sure CR/LF is not allowed. if (tgt.type == "password" || tgt.type == "text" || tgt.type == "file") { if (kc == 13 || kc == 10) { return false; } else { return true; } } //unknown (possibly body/window) - disallow. return false; } // PORTAL DRILLDOWN FUNCTIONS function prophetGraphDrilldown(newUrl) { // if contained in a portal, reaches out to the parent window, grabs the src of the iframe, and manipulates it to the newUrl // otherwise just opens the newUrl in the current window // we'll look for "prophetportalheight" in the url to determine if it's in a portal if (String(window.location).indexOf("prophetportalheight") == -1) { window.location.href = newUrl; } else { window.parent.document.getElementById(window.name).src = newUrl; } } // HELP FUNCTIONS //Used when somebody clicks the question mark on the action bar -- spawns a new window, showing the user a help page. function openHelpWindow() { // if we're entering shops, the partner may want to override the stock help with their own custom help. if (document.forms[0].jsHelpURL.value == "js-LoadedFormHelp") { helpOn = true; var defDbURL = document.forms[0].jsDefinitionsDbURL.value; var formID = document.forms[0].jsFormID.value; window.entryHelpWindowHandle = openEntryHelpWindow(defDbURL, formID, "", 0); } else { newURL = document.forms[0].jsHelpURL.value; window.open(newURL, "Help", "toolbar,menubar,scrollbars,resizable,WIDTH=800,HEIGHT=600"); }; return true; } function checkForcedHelp(formID) { if (document.forms[0].jsEditFlag.value == "1" && document.forms[0].jsForceHelp.value == "2") { var cookieData = document.cookie; //alert (cookieData); //alert (cookieData.length); if (cookieData == "") { //var exp = new Date(); //var nowPlusOneMonth = exp.getTime() + (30*86400000); //exp.setTime(nowPlusOneMonth) openHelpWindow(); document.cookie = "shown=" + formID; } else { cookieFlag = cookieData.substring(cookieData.indexOf("shown=")+6, cookieData.indexOf("shown=")+6+formID.length); //alert(cookieFlag); if (cookieFlag != formID) { //var exp = new Date(); //var nowPlusOneMonth = exp.getTime() + (30*86400000); //exp.setTime(nowPlusOneMonth) openHelpWindow(); document.cookie = "shown=" + formID; } } }; return true; }; function showMainMenuHelp(helpMessage) { getDocObject('HELP').className = "mainHelpOn" getDocObject('HELP').innerHTML = helpMessage return(0); } function clearMainMenuHelp() { getDocObject('HELP').className = "mainHelpOff" getDocObject('HELP').innerHTML = "" return(0); } function openEntryHelpWindow(defDbURL, M_ID, Q_ID, forceOpen) { var needsToLoad = false; //alert ("openEntryHelpWindow called with:\ndefDbURL: " + defDbURL + "\nM_ID: " + M_ID + "\nQ_ID: " + Q_ID + "\n"); if (Q_ID == "") { newURL = defDbURL + "/EntryHelpCtrl/" + M_ID; needsToLoad = true; } else if (entryHelpWindowHandle == null || forceOpen) { helpOn = true; newURL = defDbURL + "/EntryHelpCtrl/" + (Q_ID == "" ? M_ID : (String(Q_ID).substring(0,2) == "Q_" ? Q_ID : M_ID + "-" + Q_ID)); needsToLoad = true; } else { if (entryHelpWindowHandle.closed == true) { helpOn = false; return (entryHelpWindowHandle); } newURL = defDbURL + "/EntryHelpCtrl/" + (Q_ID == "" ? M_ID : (String(Q_ID).substring(0,2) == "Q_" ? Q_ID : M_ID + "-" + Q_ID)); if (entryHelpWindowHandle.location.pathname != newURL) needsToLoad = true; } if (needsToLoad == true) { newURL += "?OpenDocument&FormID=" + M_ID; if (forceOpen) newURL += "&Error=1"; try{ return (window.open(newURL, "EntryHelp", "menubar,resizable,scrollbars,toolbar,WIDTH=450,HEIGHT=270")); } catch (errorInfo) { return (null); } } else { return (entryHelpWindowHandle); } return false; }; // FULL SCREEN FUNCTIONS function openFullScreenWindow() { newURL = document.forms[0].jsFullScreenURL.value; window.open(newURL, "FullScreen", "status,resizable,scrollbars,menubar"); /****** Future V5 code here window.open(window.location); ********/ return true; } function openFullScreenPrintWindow() { newURL = document.forms[0].jsFullScreenPrintURL.value; window.open(newURL, "FullScreenPrint", "status,resizable,toolbar,menubar,scrollbars"); return true; } // VANILLA GENERIC FUNCTIONS THAT WE USE ALL THE TIME function getBrowserName () { if (navigator.userAgent.indexOf("Notes") != -1) { return "Notes"; }; if (navigator.userAgent.indexOf("MSIE") != -1) { return "MSIE"; } else return "Netscape"; } function getInputElement(inputName) { var e = eval("document.forms[0]." + inputName); return e; } function getDocObject(objName) { var e = (document.getElementById) ? document.getElementById(objName) : ((document.all) ? document.all(objName) : null); return (e); } function getDocObjectFromWindowHandle(objName, windowHandle) { var e = (windowHandle.document.getElementById) ? windowHandle.document.getElementById(objName) : ((windowHandle.document.all) ? windowHandle.document.all(objName) : null); return (e); } function fullTrimString(passedString) { return String(passedString.replace(/\s+/g,"")); } function getInputValue(inputName) { //though this function CANNOT be used reliably with multilists (though it will return '' or undefined) var e = getInputElement(inputName); return e.value; } //returns an array of the individual elements in the input //the caller can then iterate for validity, check .length for # of entries, etc. function getMultiInputValues(inputName) { var e = getInputElement(inputName); var s = String(e.value).split("\n"); for (var i = 0; i < s.length; i++) { s[i] = s[i].replace("\r", ""); } return s; } function getSelectedIndex(selectionName) { //though this function doesn't break with multilists, it only returns the first result var sel = getInputElement(selectionName); if (sel.selectedIndex != null) return sel.selectedIndex; //select boxes (single and multiple) for (var i = 0; i < sel.length; i ++) { //checkboxes if (sel[i].checked) return i; } return -1; } // The function below cannot be used reliably with multilsts. It doesn't break with them, but: In IE if there is no 'value' then a blank is returned. In Firefox this scenario // results in the 'text' attribute being returned instead! In any case, only the first selected option is returned. function getSelectedValue(selectionName) { //though this function doesn't break with multilists, it only returns the first result. var sel = getInputElement(selectionName); if (sel.selectedIndex != null) { //select boxes (single and multiple) if (sel.selectedIndex == -1) return(''); return sel.options[sel.selectedIndex].value; } else { for (var i = 0; i < sel.length; i++) { //checkboxes if (sel[i].checked) return sel[i].value; } return ''; } } function getSelectedText(selectionName) { //though this function doesn't break with multilists, it only returns the first result (checkboxes also return the value - not text) var sel = getInputElement(selectionName); if (sel.selectedIndex != null) { //select boxes (single and multiple) if (sel.selectedIndex == -1) return(''); return sel.options[sel.selectedIndex].text; } else { for (var i = 0; i < sel.length; i++) { //checkboxes if (sel[i].checked) return sel[i].value; } return ''; } } // cross-browser quirks here -- in IE if there is no 'value' then they will be blank as expected. FF however will use the 'text' attribute instead! function getIndexOfValue(selectionName, chkValue) { var sel = getInputElement(selectionName); if (sel.options != null) { for (var x = 0; x < sel.options.length; x++) { if (sel.options[x].value == chkValue) return x; } } else { for (var x = 0; x < sel.length; x++) { if (sel[x].value == chkValue) return x; } } return -1; } function getIndexOfText(selectionName, chkValue) { //though this function doesn't break with checkbox style multilists, it only checks against the value var sel = getInputElement(selectionName); if (sel.options != null) { for (var x = 0; x < sel.options.length; x++) { if (sel.options[x].text == chkValue) return x; } } else { for (var x = 0; x < sel.length; x++) { if (sel[x].value == chkValue) return x; } } return -1; } function getInputRadioIndex(inputName) { var e = getInputElement(inputName); if (e == null) return -1; indexCount = -1; for (var x = 0; x < e.length; x++) if (e[x].checked) indexCount = x; return indexCount; } function getSelectedRadioValue(inputName) { var index = getInputRadioIndex(inputName); if (index == -1) return (""); var e = getInputElement(inputName); return (e[index].value); } function setSelectedRadioValue(inputName, assignValue) { var e = getInputElement(inputName); for (var x = 0; x < e.length; x++) if (e[x].value == assignValue) e[x].checked = true; return true; } function countInputSelectedOptions(inputName) { var e = getInputElement(inputName); if (e == null) return 0; var c = 0; //checkboxes return an array of inputs - we'll check the "type" property. If it exists we're dealing with a select object. if (e.type) { if (e.type=="checkbox") { // single checkbox if (e.checked) c++; } else { for (var x = 0; x < e.length; x++) if (e.options[x].selected) c++; // multi-select } } else { for (var x = 0; x < e.length; x++) if (e[x].checked) c++; // assume multiple checkboxes }; return c; } // cross-browser quirks here -- in IE if there is no 'value' then they will be blank as expected. FF however will use the 'text' attribute instead! function setSelectToValue(selectionName, assignValue) { //though this function doesn't break with multilists, it effectively clears all other selections var sel = getInputElement(selectionName); var x = getIndexOfValue(selectionName, assignValue); if (sel.selectedIndex != null) { sel.selectedIndex = x; // multi-select } else { for (var i = 0; i < sel.length; i ++) { sel[i].checked = (i == x); // checkboxes } } return true; } function setSelectToText(selectionName, assignValue) { //though this function doesn't break with multilists, it effectively clears all other selections // for checkbox-style-multilists it only checks against the value, not text! var sel = getInputElement(selectionName); var x = getIndexOfText(selectionName, assignValue); if (sel.selectedIndex != null) { sel.selectedIndex = x; // multi-select } else { for (var i = 0; i < sel.length; i ++) { sel[i].checked = (i == x); // checkboxes } } return true; } function setSelectedIndex(selectionName, indexNum) { //though this function doesn't break with multilists, it effectively clears all other selections var sel = getInputElement(selectionName); if (sel.selectedIndex != null) { // select (single and multi) sel.selectedIndex = indexNum; } else { for (var i = 0; i < sel.length; i++) { sel[i].checked = (i == indexNum); // checkboxes } } return true; } function setInputValue(inputName, assignValue) { var e = getInputElement(inputName); e.value = assignValue; return true; } function massSetCheckboxField (fieldName, isChecked) { e = getInputElement(fieldName); if (e == null) return false; if (e.length == null) {e.checked = isChecked;} else for (i = 0; i < e.length; i++) {e[i].checked = isChecked;} return true; } // end vanilla functions // IFRAME FUNCTIONS // call adjustIFrame() to resize an Iframe. It binds an onLoad event to the iFrame. function adjustIFrameSize(id) { var fr = getDocObject(id); if (fr) { if (fr.contentDocument && fr.contentDocument.body.offsetHeight) { fr.height = fr.contentDocument.body.offsetHeight + 25; //W3C DOM } else if (fr.document && fr.document.body.scrollHeight) { fr.height = fr.document.body.scrollHeight + 25; //IE DOM } if (fr.addEventListener) { fr.addEventListener("load", resizeIFrame, false); } else { fr.attachEvent("onload", resizeIFrame); } } return(0); } function resizeIFrame(evt) { evt = (evt) ? evt : event; var target = (evt.target) ? evt.target : evt.srcElement; if (target.nodeType == 9) { if (evt.currentTarget && evt.currentTarget.tagName.toLowerCase() == "iframe") { target = evt.currentTarget; } } if (target) { adjustIFrameSize(target.id); } return(0); } // DIALOG BOX FUNCTIONS function activateSelectionDialog(dialogURL) { if (isBrowserOffline()) { var newPathname = "/Sub_0" + dialogURL; } else { var newPathname = dialogURL; } selectionDialogWindowHandle = window.open(newPathname, "DialogBox3", "height=350,width=550,resizable=yes,scrollbars=yes"); return true; } function activateLargeSelectionDialog(dialogURL) { largeSelectionDialogWindowHandle = window.open(dialogURL, "DialogBox4", "height=600,width=775,resizable=yes,scrollbars=yes"); return true; } function activateShopAddCommentDialog(dialogURL) { window.open(dialogURL, "DialogBox7", "height=200,width=400,resizable=yes,scrollbars=yes"); } function activateDateDialog(destField) { newPathname = window.location.pathname.slice(0, (window.location.pathname.toLowerCase()).lastIndexOf(".nsf") + 4); newURL=window.location.protocol + "//" + window.location.host + newPathname + "/DBoxWebDate?OpenForm&destField=" + destField; window.open(newURL, "DialogBox3", "height=120,width=250,resizable=no,scrollbars=no"); return true; //newPathname = top.HeaderFrame.location.pathname.slice(0, top.HeaderFrame.location.pathname.lastIndexOf("/") + 1); //newURL = top.HeaderFrame.location.protocol + "//" + top.HeaderFrame.location.host + newPathname + "DBoxWebDate?OpenForm&destField=" + destField; //window.open(newURL, "DialogBox3", "height=120,width=250,resizable=no,scrollbars=no"); //return true; } function activateTimeDialog(destField) { //newPathname = window.location.pathname.slice(0, (window.location.pathname.toLowerCase()).lastIndexOf(".nsf") + 4); if (isBrowserOffline()) { newPathname = "/Sub_0/messiah/meta.nsf"; } else { newPathname = "/messiah/meta.nsf"; } //hack fix since our time picker doesn't support anything other than US times //if (document.getElementById('prophetSampleFormatEntryTimeAM').value != "hh:mm AM" || document.getElementById('prophetSampleFormatEntryTimePM').value != "hh:mm PM") { // return(false); //} newURL=window.location.protocol + "//" + window.location.host + newPathname + "/DBoxWebTime?OpenForm&destField=" + destField + "&" + document.forms[0].prophetSampleFormatEntryCGIArgs.value; window.open(newURL, "DialogBox4", "height=120,width=250,resizable=yes,scrollbars=no"); return true; } function activateViewDialog(dialogForm) { newPathname = top.HeaderFrame.location.pathname.slice(0, top.HeaderFrame.location.pathname.lastIndexOf("/") + 1); newURL = top.HeaderFrame.location.protocol + "//" + top.HeaderFrame.location.host + newPathname + dialogForm + "?OpenForm"; window.open(newURL, "DialogBox5", "height=300,width=450,resizable=yes,scrollbars=yes"); return true; } function activateDateTimePicker() { newURL = document.forms[0].jsDTPickerURL.value; window.open(newURL, "DialogBox6", "height=400,width=450"); return true; } function getParentForm() { if (window.opener == null) { return document.forms[0]; } if (typeof window.opener == "undefined") { return document.forms[0];} else { return window.opener.document.forms[0];}; } function getParentWindow() { if (window.opener == null) { return window; } if (typeof window.opener == "undefined") { return window;} else { return window.opener;}; } function getParentElement(inputName) { var parentForm = getParentForm(); var e = eval("parentForm." + inputName); return e; } function getParentValue(inputName) { var e = getParentElement; return e.value; } function loadParentValues() { var myForm = document.forms[0]; var parentForm = getParentForm(); // why not just use our other functions? Then we end up reloading the parent object over and over again. // JavaScript's global variable handling is insufficient for our purpose here. for (var x = 0; x < myForm.elements.length; x++) { curName = myForm.elements[x].name; parentChk = eval("parentForm." + curName); if (typeof parentChk != "undefined") { if (myForm.elements[x].type == "select-one") { // list boxes must be handled slightly differently for (z = 0; z < myForm.elements[x].options.length; z++) { if (myForm.elements[x].options[z].text == parentChk.value) myForm.elements[x].selectedIndex = z; }; } else {myForm.elements[x].value = parentChk.value;}; }; }; return true; } function setParentValues() { myForm = document.forms[0]; parentForm = getParentForm(); for (x = 0; x < myForm.elements.length; x++) { curName = myForm.elements[x].name; if (curName.substring(0,1) != "%") { //skip %%surrogate fields from Domino, etc. curType = myForm.elements[x].type; parentChk = eval("parentForm." + curName); if ((typeof parentChk != "undefined") && (curName.substring(0,1) != "_") && curName.substring(0,1) != "%") { if (curType.substring(0,6) == "select") { obj = eval("myForm." + curName); e = eval("parentForm." + curName); e.value = getSelectedText(curName); } else { e = eval("parentForm." + curName); e.value = eval("myForm." + curName + ".value"); }; }; } }; return true; } function setTimeInParent(parentField) { var timeString = ""; myForm = document.forms[0]; parentForm = getParentForm(); parentChk = eval("parentForm." + myForm.destField.value); if (typeof parentChk != "undefined") { timeString = myForm.hours.value + ":" + myForm.minutes.value; if (myForm.ampm[0].checked) timeString = timeString + " AM"; if (myForm.ampm[1].checked) timeString = timeString + " PM"; parentChk.value = timeString; }; return true; } function viewSetParentUNIDValues(parentField) { var UNIDSet = "" myForm = document.forms[0]; parentForm = getParentForm(); for (x = 0; x < myForm.elements.length; x++) { if ((myForm.elements[x].type == "checkbox") && (myForm.elements[x].name == "$$SelectDoc")) { if (myForm.elements[x].checked) { if (UNIDSet == "") { UNIDSet = myForm.elements[i].value } else { UNIDSet = UNIDSet + "·" + myForm.elements[i].value } } } }; parentChk = eval("parentForm." + parentField); if (typeof parentChk != "undefined") { parentChk.value = UNIDSet; }; return true; } function viewSetParentColumnValues(parentField, columnNumber) { var tmpObj; var resultsSet = ""; var columnCount = 0; myForm = document.forms[0]; parentForm = getParentForm(); for (x = 0; x < myForm.elements.length; x++) { if ((myForm.elements[x].type == "checkbox") && (myForm.elements[x].name == "$$SelectDoc")) { if (myForm.elements[x].checked) { tmpObj = myForm.elements[x]; while (tmpObj.tagName != "TR") { tmpObj = tmpObj.parentElement; if (tmpObj.parentElement.tagName == "BODY") return true; }; columnCount = 0; for (y = 0; y < tmpObj.children.length; y++) { if (tmpObj.children[y].innerHTML != "") { columnCount ++; if (columnCount == columnNumber) { if (resultsSet == "") { resultsSet = tmpObj.children[y].innerHTML; } else { resultsSet = resultsSet + "·" + tmpObj.children[y].innerHTML; } } } } } } }; parentChk = eval("parentForm." + parentField); if (typeof parentChk != "undefined") { parentChk.value = resultsSet; }; return true; } /* Reference example for selectable view HTML code