Hi, I'm really enjoying the simplicity of Web2py. However, for the life of me, I cannot figure out a way to accomplish this without re-writing FORM/SQLFORM. So, I know I'm not understanding something :)
I'm writing a small app to make lists. Each list has many "items". I'd like a user to be able to create a List, and the list may have as many items as needed. When the user creates a list, there is a form field for one item. When they "focus" or "blur" or interact with that item field, another one appears below, via ajax. They continue to add items until they're finished. What I cannot figure out is how to pass back the additional form field via ajax, or how to select (via ajax) the form itself. Here is my model: db.define_table('listy', Field('title'), Field('description','text'), Field('created_on','datetime',default=request.now), Field('created_by',db.auth_user, default=auth.user_id), format='%(title)s') db.define_table('entry', Field('listy_id',db.listy), Field('item','string', length=144)) And my basic controller stuff to create a list: @auth.requires_login() def create(): """create a new empty list""" # form = crud.create(db.listy, next=URL('index')) form = SQLFORM.factory(db.listy, db.entry,formstyle='divs') if form.process().accepted: id = db.listy.insert(**db.listy._filter_fields(form.vars)) form.vars.listy=id id = db.entry.insert(**db.entry._filter_fields(form.vars)) response.flash = 'Success! Thanks!' return dict(form=form) Any help is appreciated. Thanks so much!