Hi Derek, Ive tried and its working... Thanks (see attached) i will just have to create a separate user registration view and not use the default 'user/register' to have this function in my auth_user registration Thanks...
On Friday, July 31, 2015 at 2:30:56 PM UTC+8, Derek wrote: > You will want to take a look at my example here: > > http://www.web2pyslices.com/slice/show/1724/cascading-dropdowns-simplified > > let me know if you have questions. You should be able to easily extend it > to do multi level cascading. > > On Tuesday, July 28, 2015 at 3:30:18 PM UTC-7, Wabbajack wrote: >> >> I have created a *factory,department,section and team* table in the >> database >> and a *factory* is on a *one to many* relationship with *department* >> a *department* is on a *one to many* relationship with* section* >> a *section* is on a *one to many* relationship with* team* >> >> *Table names* >> factory = portal_factory >> department = portal_department >> section = portal_section >> team = portal_team >> >> *db.py codes* >> ## *Factory* >> db.define_table('portal_factory', >> Field('name', notnull=True , required=True,unique=True) >> ) >> ## *Department* >> db.define_table('portal_department', >> >> Field('factory_id',db.portal_factory,notnull=True,required=True,requires=IS_IN_DB(db, >> db.portal_factory.id,'%(name)s')), >> Field('name',notnull=True,required=True,unique=True) >> ) >> ## *Section* >> db.define_table('portal_section', >> >> Field('department_id',db.portal_department,notnull=True,required=True,requires=IS_IN_DB(db, >> db.portal_department.id,'%(name)s')), >> Field('name', notnull=True, required=True, unique=True), >> ) >> ## *Team* >> db.define_table('portal_team', >> >> Field('section_id',db.portal_section,notnull=True,required=True,requires=IS_IN_DB(db, >> db.portal_section.id,'%(name)s')), >> Field('name', notnull=True, required=True, unique=True), >> ) >> >> ## This is the tricky part >> ##i want to dynamically make an option list in the *t_department based >> on the selected t_factory* >> ##i want to dynamically make an option list in the* t_section based on >> the selected t_department* >> ##i want to dynamically make an option list in the* t_team based on the >> selected t_section* >> >> ## Extra fields on auth_user for registration >> auth.settings.extra_fields['auth_user']=[ >> Field('t_factory','reference portal_factory',label='Factory',notnull = >> True,required = True,requires=IS_IN_DB(db, db.portal_factory.id >> ,'%(name)s')), >> Field('t_department','reference >> portal_department',label='Department',notnull = True,required = >> True,requires=IS_IN_DB(db, db.portal_department.id,'%(name)s')), >> Field('t_section','reference portal_section',label='Section',notnull = >> True,required = True,requires=IS_IN_DB(db, db.portal_section.id >> ,'%(name)s')), >> Field('t_team','reference portal_team',label='Team',notnull = >> True,required = True,requires=IS_IN_DB(db, db.portal_team.id >> ,'%(name)s')), >> ] >> >> i have an attached file where this what i want to happen upon registration >> >> Upon registration if i select *factory* *A *there are different *department >> *selections in the dropdown (dropdown.png) >> same as if i select *factory B *there are different *department *selections >> in the dropdown (dropdown2.png) >> this setup will just follow for *department *to *section *and *section *to >> *team* >> >> Thank you in advance for your help...More power to web2py >> >> >> > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

