diff --git a/www/extras/yui-webgui/build/form/form.js b/www/extras/yui-webgui/build/form/form.js index ff52b6f3a..89c6be4cd 100644 --- a/www/extras/yui-webgui/build/form/form.js +++ b/www/extras/yui-webgui/build/form/form.js @@ -50,3 +50,89 @@ WebGUI.Form.toggleAllCheckboxesInForm */ WebGUI.Form.toggleAllCheckboxesState = {}; + +/*********************************************************************************** + * @description This method assembles the form label and value pairs and + * constructs an encoded string. + * @method buildQueryString + * @public + * @static + * @param {string || object} form id or name attribute, or form object. + * @param {object} object containing array of form elements to exclude. { id:[], name:[], classNames:[], type:[] } + * @return {string} string of the HTML form field name and value pairs. + */ + +WebGUI.Form.buildQueryString = function ( formId, excludes ) { + + var _isInArray = function ( value, array) { + if(!array || !value) return 0; + if(typeof array != 'object') return 0; + + for(var i = 0; i < array.length; i++) { + if(array[i] == value) return 1; + } + return 0; + }; + + var oForm = (document.getElementById(formId) || document.forms[formId]); + var oElement, oName, oValue, oDisabled; + var sFormData = ""; + + if(!excludes) { + excludes = {}; + } + + // Iterate over the form elements collection to construct the label-value pairs. + for (var i=0; i