You are right. You do not need a reference field to get the dropdown. The IS_IN_DB or IS_IN_SET validators trigger the dropdown. I will take this into account when revising the book. In my todo list.
Thanks for bringing this up. Massimo On Apr 16, 4:43 pm, JohnMc <maruadventu...@gmail.com> wrote: > Sir, > > Do appreciate your attention and reply. > > I am new to web2py so correct me if I am wrong -- > > A) > db.define_table('states', > SQLField('State','string',length=2) > ) > > db.define_table('provider', > ... > ... > SQLField('State',db.states) > ) > > This provides a link between the states and provider tables correct? > That the contents of provider.State will be the states.id value? > > B) > db.define_table('states', > SQLField('State','string',length=2) > ) > > db.define_table('provider', > ... > ... > SQLField('State','string') > ) > > db.provider.State.requires=IS_IN_DB(db,'states.State','%(State)s') > > Here IS_IN_DB validates that there is a valid value in states.State > and writes that value in provider.State. Correct? IS_IN_DB is the > causative agent in a select field being defined in the db admin form? > (At least that is how it is acting for me right now.) > > If all those are the case I have a minor suggestion if you revise the > manual in the future. What tripped me up was the belief that 'SQLField > ('State',db.states)' is required for a select field, not the > validator. An example without the link might make that clear. Chalk it > up to my minimal exposure to web2py. > > Again thanks for the assist. > > JohnMc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---