not necessarily, it can be a list of one element.

On Jun 18, 6:11 pm, Peter Etchells <peter.a.etche...@gmail.com> wrote:
> thanks, that worked perfectly.
>
> Q2: is it correct that if there is only one validator for the field,
> field.requires is not a list, but if >1 validator, it is?
>
> On Jun 19, 3:46 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > should be
>
> > myfield=db['mytable'][field]
> >   if field.type=='integer':
> >     if isinstance(field.requires[0],validator.IS_INT_IN_RANGE):
> >        minimum = field.requires[0].minimum
> >        maximum = field.requires[0].maximum
>
> > On Jun 18, 2:16 am, Peter Etchells <peter.a.etche...@gmail.com> wrote:
>
> > > Hi web2pyzeans
> > > I want to be able to access the type and parameters of validators for
> > > a given field.
>
> > > How would I do something like:
> > > myfield=db['mytable'][field]
> > > if field.type=='integer':
> > >  if field.requires[0] == validator.IS_INT_IN_RANGE:
> > >      min = the min arg of the IS_INT_IN_RANGE validator for the field
> > >      max= the min arg of the IS_INT_IN_RANGE validator for the field
>
> > > thanks
--~--~---------~--~----~------------~-------~--~----~
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