OK, my code here relies heavily on the Prototype library, but I will try and explain as best as I can. I am trying to cycle through some form elements, using prototypes CSS selectors. This returns an array. I am then looping through the array with the .each enumerable. Each time, I am taking the element, in this case it passes the object itself, and getting the name attributes and the value of the element. I then use the name as the key and the value of the element as the value of the array. The code thus far looks like this:
[code]
$$(‘#reportHeaderContent input’).each(function(el){
//detect type, so we can adjust accordingly
var inputType = el.getAttribute(‘type’);
var inputName = el.getAttribute(‘name’);
var inputValue = el.value;
//depending on type – we will populate array with proper information
if(inputType == ‘text’){
inputParameters[inputName] = inputValue;
}else if(inputType == ‘checkbox’ || inputType == ‘radio’){
if(el.checked == 1){
inputParameters[inputName] = inputValue;
}
}
});
Everything, thus far, works. I can alert the array, although I do have to know the key ahead of time. That will be taken care of later, though, in PHP.
Now is the tricky part. I am going to send this via the Ajax.Updater object in Prototype. Code below:
[code]
new Ajax.Updater(‘mainReportContainer’, ‘/’+actualDomain+’/’+actualLocation, {method: ‘post’, evalScripts: true, parameters:{ajax: ‘ajax’, inputParams: inputParameters }});
Don’t worry about the actual location and domain part. They work, too. Now, in my PHP I detect whether the ajax param is set and execute some arbitrary code based on it. The problem is that it’s not sending the second parameter, inputParams. It sends the ‘ajax’ param, but not the second.
Any suggestions?