This cannot be done out of the box. You need to use ajax to make a
part of page dependent on another part of the same page.
assuming you have form=SQLFORM(db.tourplan), the in your HTML you need
something like
$('#tourplan_city').change(function(){ $.ajax( ........ ) }
and write the .... code that sends the city to the server and changes
the content of the select dropbox.
Massimo
On Apr 15, 3:58 am, Morten Jeppesen <[email protected]> wrote:
> Hi all
>
> Posted this already - but apparently it did not show - so here we go
> again.
>
> I have the following problem (I am a rookie - so forgive me if this is
> already explained elsewhere):
>
> db.define_table('country', SQLField('name','string'))
>
> db.define_table('city',
> SQLField('country',db.country),
> SQLField('name','string'))
>
> db.city.country.requires = IS_IN_DB(db, 'country.id', 'country.name')
>
> db.define_table('tourplan',
> SQLField('date', 'date'),
> SQLField('country',db.country),
> SQLField('city',db.city)
> )
>
> db.tourplan.country.requires = IS_IN_DB(db, 'country.id',
> 'country.name')
> #db.tourplan.city.requires = IS_IN_DB(db(db(?), 'city.id',
> 'city.name') #Not working as intended
>
> What I would like to happen is the following:
> Enter some contries in the country table.
> Enter some cities in the city table and relate them to their country
> Enter a tourplan, by selecting a date, a country (from the dropdown)
> and a corresponding city (from the dropdown).
>
> What I would like to happen is that the last city dropdown only shows
> the cities that "belongs" to the previously selected country. I just
> don't know how to make that happen.
>
> Hope that someone can help. Thank you.
> /Morten
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---