io-form.js revision a23a8b9cc849a2aa697a3820f45e1b0f652f4e53
/**
* Extends IO to enable HTML form data serialization, when specified
* in the transaction's configuration object.
* @module io-base
* @submodule io-form
* @for IO
*/
var eUC = encodeURIComponent;
/**
* 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 - Key-value data defined in the configuration object.
* @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);