I propose to add a new kind of selector ":active". This selector should select these form elements which are active (that is are to be submitted when the form is submitted).
With this selector we would be able to do the following:
- var data = {};
for(var i=0; i<form.elements.length; ++i) {
var elt = form.elements[i];
if($(elt).is(':active'))
data[elt.name] = elt.value;
}
$.post(form.action, data, function(text){/*...*/});
As there are no such selector, I need the following bogus code:
- var data = {};
for(var i=0; i<form.elements.length; ++i) {
var elt = form.elements[i];
if(!$(elt).is(':radio') || $(elt).is(':checked'))
data[elt.name] = elt.value;
}
$.post(form.action, data, function(text){/*...*/});