input collection function for AJAX
handgestrickt wrote a function that collects input-field content by a given regular expression of the id. we needed it beside the $F()- and Form.serialize()-function provided by Prototype.js . unfortunately it provides no function to make an associative array of the input-fields' names and values. here is the code:
var foo = {
getInputsByFragment: function(element,fragment) {
var result = {};
var inputs = $(element).getElementsByTagName('input');
for(var a=0;a<inputs.length;a++) {
if(
inputs[a].id.search(fragment) != -1 &&
inputs[a].value != ''
) result[inputs[a].id.replace(fragment,'')] = inputs[a].value;
}
return result;
}
}
usage:
foo.getInputsByFragment('contactform',/^contact_/);
feel free to use it. did a great job for us!

