io-form-debug.js revision f675023bc7d7e00eff60080f3b554ce49dd9795f
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * Extends the IO base class to enable HTML form data serialization, when specified
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * in the transaction's configuration object.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * @module io
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * @submodule io-form
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov * @description Method to enumerate through an HTML form's elements collection
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * and return a string comprised of key-value pairs.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov * @method _serialize
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * @param {object} o - YUI form node or HTML form id.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov * @return string
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov _serialize: function(o) {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe var id = (typeof o.id === 'string') ? o.id : o.id.getAttribute('id'),
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // Iterate over the form elements collection to construct the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // label-value pairs.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe for (i = 0, ilen = f.elements.length; i < ilen; ++i) {
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov if ((useDf) ? n : (n && !d)) {
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov switch (e.type) {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // Safari, Opera, FF all default options.value from .text if
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov // value attribute not specified in markup
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov case 'select-one':
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe data[item++] = n + eUC((o.attributes.value && o.attributes.value.specified) ? o.value : o.text);
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe case 'select-multiple':
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov for (j = e.selectedIndex, jlen = e.options.length; j < jlen; ++j) {
if(e.checked){
case undefined: