****** 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), 
                                                    "client.id", '%(d_ln)s, 
%(d_fn)s')
        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.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to