Hi,
Reading past posts about this topic and the book I didn't realize how to solve it. Imagine to have the subsequent controller called "bar"

d = dict(
        a=[1,2,3],
        b=[4,5,6])
def foo(k):
    if k in d:
        return d[k]
    else:
        l = []
        for i in d.values():
            l += i
        return l

def bar():
    form = SQLFORM.factory(
        Field('username', requires=IS_NOT_EMPTY()),
        Field('key', requires=IS_IN_SET(d.keys())),
        Field('value', requires=IS_IN_SET(foo(request.vars.key))))
    if form.accepts(request.vars, session):
        pass # or take some action
    return dict(form=form)

What's the Ajax I have to add to my view in order to modify on the fly the drop down list of the "value" field?

Thank you very mutch in advance
Cheers
        Manuele

Reply via email to