This is an old issue that I'm finally getting back to. I've researched
this forum heavily for indications about how to do this and have
concluded that perhaps there is some new functionality in web2py that
will accomplish this for me automatically.
The issue is I want a form with two drop downs where the value of the
2nd drop down is contingent on the value of the first.
#models
db.define_table('animal',Field('name'))
db.define_table('pet',Field('name'),Field('animal',db.animal,requires=IS_IN_DB(db,'
animal.id','%
(name)s'))
# animal is preloaded with 2 types: "dog" and "cat"
# pet is preloaded with a few pets:
# rex, dog
# bowser, dog
# luna, cat
# felix, cat
#controller
form=SQLFORM.factory(db.animal,db.pet)
...
When the form is displayed, I want it so that when the animal type is
set to dog, the pet names will only display "rex" and "bowser". If the
user selects the animal type to "cat", then the pet list dynamically
changes to "luna" and "felix".
What is the latest and greatest way to accomplish this? Should I be
going to jQuery (my default choice)?