Your model looks good. You will need to use javascript and ajax to get
the effects that you desire.

Basically, hook into the first options box "change" event, and
on_change send an ajax request to the server requesting the 'spenton'
fields for 'spent', and then take the returned results and populate
option box two with it.

--
Thadeus





On Fri, Apr 30, 2010 at 5:39 AM, kibrun <[email protected]> wrote:
> Dear all,
>
>     I'm new in python and currently trying web2py. I need some help
> to build a chained option box - meaning when i choose an item in
> option1's list, option2's list automatically change to a specific list
> that falls under option1's subject:
>
> db.define_table('spent',
>                SQLField('spent'))
>
> db.define_table('spenton',
>                SQLField('herespent'),
>                SQLField('spent_id', db.spent))
> db.spenton.spent_id.requires=IS_IN_DB(db, db.spent.id, '%(spent)s')
>
> if i choose an entry from option list of db.spent, the option list
> under db.spenton.herespent will change according to the respective
> spenton.spent_id without displaying the rest of the entries in
> 'herespent'
>
> I need to know what is the simplest way to do it in web2py? thanks in
> advance.
>

Reply via email to