****** Splits the input "name" attribute up => generates a query => creates sqlform => returns form
def ajax_form_creator():
for k,v in request.vars.iteritems():
field_array = k.split('-')
this_page_form = db[field_array[3]].id==field_array[1]
db[field_array[3]].client.requires=IS_IN_DB(db(
db.client.id == x),
db[field_array[3]].client.default = x
ajax_form = SQLFORM(db[field_array[3]], this_page_form, deletable=True).process()
ajax_form['_id']="Ajax_Form"
return ajax_form
****** Button triggers the above script on click. The result, the ajax_form, should be sent to the target div
<form>
<input name="1-2-street_1-client_address" type="button" onclick="ajax('{{=URL('default', 'ajax_form_creator')}}', [$(this).attr('name')], 'target')" />
</form>
<div id="target"></div>
******
Nothing loads in the target div despite the fact that I know the connection works (i.e., I can get it to load other data into the target). Should I serialize the SQLFORM object? If so, how? Any thoughts are greatly appreciated.