This commit is contained in:
Gilles van den Hoven 2006-06-01 16:40:37 +00:00
parent 5ee555c9f0
commit 4a36d00466

View File

@ -145,27 +145,36 @@ $.fn.formValues = function(sButton) {
// Loop the shite // Loop the shite
$('*', this).each(function() { $('*', this).each(function() {
// Skip disabled elements
if (this.disabled)
return;
// Skip elements not of the types in elp // Skip elements not of the types in elp
if (!elp[this.tagName.toUpperCase()]) if (!elp[this.tagName.toUpperCase()])
return; return;
// Skip disabled elements, submit buttons and image buttons // Skip submit buttons and image elements
if ((this.disabled) || (this.type == 'submit') || (this.type == 'image')) if ((this.type == 'submit') || (this.type == 'image'))
return; return;
// Skip non-selected nodes
if ((this.parentNode.nodeName == 'SELECT') && (!this.selected)) // Skip non-selected options
var sP = this.parentNode.nodeName.toUpperCase();
if (((sP == 'SELECT') || (sP == 'OPTGROUP')) && (!this.selected))
return; return;
// Skip non-checked nodes // Skip non-checked nodes
if (((this.type == 'radio') || (this.type == 'checkbox')) && (!this.checked)) if (((this.type == 'radio') || (this.type == 'checkbox')) && (!this.checked))
return; return;
// If we come here, everything is fine, so add the data // If we come here, everything is fine
a.push({ var sN = this.name || this.id || this.parentNode.name || this.parentNode.id;
name: this.name || this.id || this.parentNode.name || this.parentNode.id, var sV = this.value;
value: this.value if ((!sN) && (sP == 'OPTGROUP'))
}); sN = this.parentNode.parentNode.name || this.parentNode.parentNode.id;
// Add the data
a.push({ name: sN, value: sV });
}); });
// Add submit button if needed // Add submit button if needed