This is not a bug. I misunderstood the question.

db.define_table('states',
                SQLField('State','string',length=2)

)

db.define_table('provider',
                ...
                ...
                SQLField('State'),  ### has to be a string to store a
string in it.
                ...
                ...
)
db.provider.State.requires=IS_IN_DB(db,'states.State','%(State)s')

On Apr 15, 7:03 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Let me look into this tonight. It may be a bug.
>
> Massimo
>
> On Apr 15, 3:29 pm, JohnMc <maruadventu...@gmail.com> wrote:
>
> > Hmm. Unfortunately I receive --
>
> >   File "/home/rootuser/web2py/gluon/sqlhtml.py", line 544, in accepts
> >     fields[fieldname] = int(fields[fieldname])
> > ValueError: invalid literal for int() with base 10: 'TX'
>
> > Thanks
>
> > On Apr 15, 3:06 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > db.provider.State.requires=IS_IN_DB(db,'states.State','%(State)s')
>
> > > Massimo
>
> > > On Apr 15, 2:59 pm, JohnMc <maruadventu...@gmail.com> wrote:
>
> > > > I have a similar situation to that of Mr. Jeppesen. Here is the setup
> > > > --
>
> > > > db.define_table('states',
> > > >                 SQLField('State','string',length=2)
>
> > > > )
>
> > > > db.define_table('provider',
> > > >                 ...
> > > >                 ...
> > > >                 SQLField('State',db.states),
> > > >                 ...
> > > >                 ...
>
> > > > )
>
> > > > db.provider.State.requires=IS_IN_DB(db,'states.id','%(State)s')
>
> > > > If one fills out a form the appropriate State dropdown appears. When a
> > > > database db select is performed the provider.State contains the number
> > > > 3. That happens to be the proper states.id for the entry. My question
> > > > is how does one have say 'TX' rather than 3 as the entry in
> > > > provider.State?
>
> > > > Sorry for the newbieness of the query.
>
> > > > Thanks.
>
> > > > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to