У меня для преобразования хэша в форму используется вот такая функция
var add = function(elementName,className,before)
{
if(!elementName)
return;
if(!className)
className=''
var element =document.createElement(elementName)
if(this!=window)
{
if(before && before.parentNode==this)
this.insertBefore(element,before)
else
this.appendChild(element)
}
element.className=className
element.add=add
element.set=set
element.clearit=clearit
element.clone=clone
element.addField=addField
return element
}
function addHiddenInput(form,name,value)
{
var input = add('input')
input.setAttribute('type','hidden')
input.setAttribute('name',name)
input.setAttribute('value',value)
form.appendChild(input)
}
function convertHashToForm(data,form,name)
{
if(typeof(form)=="undefined")
{
form = add('form')
}
if(typeof(name)=="undefined")
{
name = ""
}
if(typeof(data)=="object" && typeof(data.tagName)=='undefined') for(var k in data)
{
var newName = ""
if(name == "")
newName = k
else
newName = name + "["+k+"]"
var value = data[k]
if(typeof(value)=='object' && value != null)
{
convertHashToForm(value,form,newName)
}
else
{
addHiddenInput(form,newName,value)
}
}
return form
}