Hello everyone,

I'm developing a rather complex form where the selection options need to 
depend on what the user selects in a previous field.
As a simplistic example, let's say there are two models, Owner and Thing, 
where an Owner can have multiple Things. I would like to have a form where 
you first pick an Owner, and then pick a Thing that the Owner has (and only 
Things the owner has). Ideally this would be done without using multiple 
forms (as I have many such complicated fields). There can be many owners so 
it is not feasible to have a hidden dropdown for each owner.

Here is sort-of what I envision:
db.define_table("person", Field('name'))
db.define_table("thing", Field('owner', 'reference person'))
db.define_table("thing_selection", Field('owner', 'reference person'), 
                Field('thing', 'reference thing', 
requires=IS_IN_DB(db(thisform.thing.owner == thisform.person.id), 
'thing.id'))
                )

where thisform is what the user is submitting as a SQLFORM (or crud.create)

I imagine the solution will likely require AJAX. Is there a good resource 
or practice or things to keep in mind for editing a dropdown form with 
ajax, and how might I do it? Or if you have any other suggestions they are 
welcome. Thanks!

-- 
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