- var a = new Array();
- this.find("input[@type='submit'],input[@type='hidden'],textarea,input[@checked],input[@type='password'],input[@type='text'],option[@selected]")
- .filter(":enabled").each(function() {
- o = {};
- o['name'] = this.name || this.id || this.parentNode.name || this.parentNode.id;
- o['value'] = this.value;
+ var a = [];
+ this.find("input,textarea,option")
+ .filter(":enabled")
+ .each(function() {
+ //
+ // Skip selects with options which aren't selected
+ if (((this.parentNode.type == 'select-one') || (this.parentNode.type == 'select-multiple')) &&
+ (!this.selected))
+ return;
+
+ //
+ // Skip radio and checkbox elements which aren't checked
+ if (((this.type == 'radio') || (this.type == 'checkbox')) &&
+ (!this.checked))
+ return;
+
+ //
+ // All other elements are valid ;)
+ var o = {};
+ o.name = this.name || this.id || this.parentNode.name || this.parentNode.id;
+ o.value = this.value;