Something like this:

def validate_title( form ):
    if not re.match("^[a-z0-9\s\_]+$", form.vars.title):
        form.errors.title = "invalid title"


On Apr 7, 12:26 am, mdipierro <[email protected]> wrote:
> what is in validate_title?
>
> On Apr 6, 11:15 pm, VP <[email protected]> wrote:
>
>
>
>
>
>
>
> > In  my app, i used isonvalidation to do extra validation of the input,
> > on creation and on update.
>
> > Something like this:
>
> > +creation:
>
> >     form = SQLFORM(db.=entry)
> >     if form.accepts(request.vars, session,
> > onvalidation=validate_title):
>
> > +update:
> >     entry = db.entry(request.args(0))
> >     form = SQLFORM(db.entry, entry, upload=URL('fast_download'),
> > deletable=True)
> >     if form.accepts(request.vars, session,
> > onvalidation=validate_title):
>
> > It seems that onvalidation works as expected for creation , but does
> > not seem to work as expected (even though the validation function is
> > executed); i.e. the submission goes through even though it should be
> > invalid.
>
> > Any idea? Thanks.

Reply via email to