Acculon, that is helpful, though not exactly what I need. Anyway, I'm
making some progress.

Does anyone know exactly how to replace the contents of a SELECT? In
other words, I have a bunch of options that I want to build up then
pass back via AJAX to the select list. But I can't seem to get it to
work exactly right. I'm having to encapsulate the entire select list
by a DIV and then replace the entire contents of the DIV, select list
and all options.

On Jul 10, 4:12 pm, "[email protected]" <[email protected]> wrote:
> This may be what you are looking for:
>  http://groups.google.com/group/web2py/msg/1c4897120e4f124b
>  http://groups.google.com/group/web2py/browse_thread/thread/4a6149ddcb...
>
> On Jul 10, 8:12 pm, weheh <[email protected]> wrote:
>
> > 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)?

Reply via email to