On Jan 11, 11:19 am, pihentagy <pihent...@gmail.com> wrote:
> On Jan 11, 2:57 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > You can create your own field-level validators
>
> > class validator:
> >    def __init__(self,error_message): self.error_message=error_message
> >    def __call__(self,value):
> >        if success: return (value,None)
> >        else: return (value,self.error_message)
>
> Yes of course, but I thought some "stock" date validators are worth to
> discuss. There are IS_INT_IN_RANGE and friends, then why not
> IS_DATE_IN_RANGE (maybe with defaults to None for both min and max
> date).

I would take a patch to include IS_DATE_IN_RANGE

> > both form.accept and crud.create/crud.update take a parameter
> > onvalidation
>
> > onvalidation can point to a function that takes a form, reads
> > form.vars and writes form.errors
>
> > def f(form):
> >     if not form.vars.a==form.vars.b: form.errors.b="should be == a"
> > form = crud.create(...., onvalidation = f)
>
> But this way the validation is not built into the form/model :(

what do you mean?
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@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