I have a field regex which contains requires segements like "IS_MATCH('^
\d{3}-\d{4}-\d{4}-\d{1}?$')" in an administrative table

I store them as as Storage types and then retrieve and apply it to a
Form like this:
    Field('f4', requires=IS_EMPTY_OR(settings.regex[4]))

In a model file, it's defined as:
    settings=Storage()
    settings.regex={
        0:IS_MATCH('^\d{3}-\d{4}-\d{4}-\d{1}?$'),
        1:IS_MATCH('^\d{4}-\d{3}-\d{3}-\d{1}?$'),
        }
That worked fine. Now, however, I couldn't use the values I retrieve
from a record field because they are strings. I hope to use it like this
    ...
    record=db.id_card_number(person==1,card==2)
    form=SQLFORM.factory(Field('f4','string'))
    form.f4.requires=record.regex
    ...


/r,
Nik

Reply via email to