io-form-debug.js revision f54bfd7ba78fe5943d443088e8e9b48e10191318
/**
* Extends the IO base class to enable HTML form data serialization, when specified
* in the transaction's configuration object.
* @module io
* @submodule io-form
*/
var eUC = encodeURIComponent;
/**
* @description Method to enumerate through an HTML form's elements collection
* and return a string comprised of key-value pairs.
*
* @method _serialize
* @private
* @static
* @param {object} c - YUI form node or HTML form id.
* @param {string} s - Transaction data defined in the configuration.
* @return string
*/
_serialize: function(c, s) {
var data = [],
df = c.useDisabled || false,
item = 0,
if (!id) {
}
// Iterate over the form elements collection to construct the
// label-value pairs.
e = f.elements[i];
d = e.disabled;
n = e.name;
if (df ? n : n && !d) {
n = eUC(n) + '=';
switch (e.type) {
// Safari, Opera, FF all default options.value from .text if
// value attribute not specified in markup
case 'select-one':
if (e.selectedIndex > -1) {
o = e.options[e.selectedIndex];
}
break;
case 'select-multiple':
if (e.selectedIndex > -1) {
o = e.options[j];
if (o.selected) {
}
}
}
break;
case 'radio':
case 'checkbox':
if (e.checked) {
}
break;
case 'file':
// stub case as XMLHttpRequest will only send the file path as a string.
case undefined:
// stub case for fieldset element which returns undefined.
case 'reset':
// stub case for input type reset button.
case 'button':
// stub case for input type button elements.
break;
case 'submit':
default:
}
}
}
}
}, true);