On Sep 3, 8:12 am, grou...@reenie.org wrote:
No,
Please don't top post, reply below trimmed quotes.
but close. I knew where the form iteration occured and when I
looked at it it was like this:
var numberElements = frm.elements.length-1;
for(var i = 0; i < numberElements; i++) {
queryString+=frm.elements[i].name
+"="+encodeURIComponent(frm.elements[i].value);
if(i < numberElements-1) queryString+="&";
}
So for some reason, it was written to always skip the last element. I
took out the -1 from "length-1" and it works as expected now. Thanks,
you really helped.
You should also only return controls that have a value for the name
attribute, and do not expect select elements to return their value in
all browsers (though likely those that don't aren't supported by your
"AJAX" form anyway).
You might also consider using an array to join the value/name pairs
with '&', something like:
function ... ()
{
var element, queryString = [];
var numberElements = frm.elements.length;
for(var i=0; i<numberElements; i++) {
element = frm.elements[i];
if (element.name && element.name != '') {
queryString.push(element.name + "="
+ encodeURIComponent(element.value));
}
}
return queryString.join('&'); }
}
--
Rob