I'm using *the same* web2py_component() function in 3 different forms in my 
application. In 2 cases the function gets the job done. In the third form 
web2py_component() doesn't work - no request is being sent.

Do you guys know any reason why web2py_component() wouldn't get triggered?

CODE
---------

1. User selects a department from drop box

<select class="generic-widget" id="seafarer_experience_department" name=
"department" onchange="updateranks(jQuery('[name=department]').val());">...
</select>

2. Depatment value gets processed by script generated like this:

_id = "%s_%s" % (field._tablename, field.name)

script = SCRIPT("""
    function updateranks(departmentId) {
        web2py_component("%(url)s/" + parseInt(departmentId)" + 
"?v=%(var)s", "%(_id)s");
    }
    """ % dict(_id=_id,
               url=URL("seafarer", "populate"),
               var=field._tablename))

3. The script above sends request to *populate* function. The function 
returns respective ranks, based on the department value chosen:

def populate():
    if request.vars.v:
        tablename = request.vars.v
        db[tablename].rank.requires = 
IS_IN_DB(db(db.rank.department_id==request.args(0)), 'rank.id', '%(name)s', 
zero=None)
        form = SQLFORM(db[tablename])
        text =  "".join([t.xml() for t in 
form.custom.widget.rank.elements("option")])
        return text

-- 

--- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to