Hello,

i recently tried the following:

def test4():
    form = SQLFORM.factory(
        Field("name", length=25),
        Field("opts", "list:string",
              requires=IS_IN_SET(['one', 'two','three'], multiple=True),
              widget=SQLFORM.widgets.checkboxes.widget),
        )

    if form.accepts(request, session, onvalidation=is_valid):
        return "splendid"
    
    # Use generic HTML views
    response.generic_patterns = ['html']
    return dict(form=form)

def is_valid(form):
    if 'two' not in form.vars.opts:
        form.errors.opts = "Must select option two"
    return


 and found that with web2py trunk (and the latest release) i don't see the 
error if i don't select option two.  form.errors has the error...

i did some digging, and found that for some reason when using a SQLFORM if 
the field type is "list:" it chooses not to display the error.  i don't 
know why this check was in there, but in the attached patch (against trunk) 
i remove that check.  can anyone remember why that check is there and what 
i might be breaking by suggesting that we remove it?

thanks!

christian

Attachment: list-validation-patch.out
Description: Binary data

Reply via email to