Hello Guys,

I made a Validator which should check if the value is in the list, but only 
if an expression is True.
It works fine BUT it produces no dropdown. Hope you can help me:

Class:

class IS_IN_SET_CONDITIONAL():
    def __init__(self, liste, expression, error_message="Value not allowed"
):
        self.expression = expression
        self.error_message = error_message
        self.liste = liste

    def __call__(self, value):
        if self.expression:
             if value in liste:          
                    return (value,None)
             else:
                    return(value, self.error_message)

        else:
            return (value, None)


Field:

Field("Letter", label="Letter", requires=IS_IN_SET_CONDITIONAL(['A', 'B', 
'C'], Expression)),


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/913d9932-3770-4881-a8aa-5394456a473f%40googlegroups.com.

Reply via email to