Consider this case:

db.define_table('numbers',Field('a','integre'),Field('b','integer'))
def validate(form):
    if form.vars.a+form.vars.b>100:
        form.errors.b="a+b must not exceed 100"
form=crud.create(db.numbers,onvalidation=validate)

Before the change the function validate is not called if a and b are
not valid integer this never triggering an exception, only validation
errors.

With your proposed change this would cause an error because
form.vars.a is None if request.vars.a does ot pass the default integer
validation. The function validation would be called again and issue a
ticket.

This is a change of behavior. I am not convinced this change is a good
idea.

Why do you need it?
Other opinions?

Massimo

On Nov 26, 11:34 am, "mr.freeze" <nat...@freezable.com> wrote:
> Changing line 1565 of html.py from...
>         if status and onvalidation:
> to...
>         if vars and onvalidation:
>
> On Nov 26, 11:28 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > What would you suggest?
>
> > On Nov 26, 11:10 am, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > I see two issues with this:
> > > 1) The form errors found in onvalidation will not be displayed if
> > > there are already form errors
> > > 2) The developer never gets a chance to remove form errors for certain
> > > conditions (think contingent form fields)
> > > For example, I am using IS_IN_DB on a field but I only want it to be
> > > required if another field is a certain value.
>
> > > Is there a better way?
>
>

Reply via email to