You do not need another controller in my opinion. You can simply do:
def user():
if request.args(0)=='register':
response.files.append(URL('static','js/deal-with-fields.js'))
return dict(form=auth())
and then you put what you need in the deal-with-fields.js
On Friday, 31 July 2015 08:27:31 UTC-5, Wabbajack wrote:
>
> Hi Massimo
>
>
> Ive read your reply...thats what we have been working on today...
> We tried using static dictionaries with sub groups...to a registration
> form
> with our factories , department, section and teams... :)
>
> But if we do that i think we cannot use the 'user/register' page?
> It is still possible if we can manipulate the 'user/register' page?
> Right now we are making a new_registration controller and view...with
> static dictionaries i will just post the code once its done...
>
> Im sorry im just a 2 months old in python and a month old in web2py..and
> a new comer in web development
> Its just our boss really...
>
> But the web2py community is very good....rapid development using web2py is
> very impressing
>
> ive never expect a reply actually...but also i have never expect it
> coming from you...
>
> Thank you very much..
>
>
> On Wednesday, July 29, 2015 at 6:30:18 AM UTC+8, 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.