ok, trying to do the ajax drop down list as well-written under:

http://www.web2pyslices.com/slice/show/1526/cascading-drop-down-lists-with-ajax-2

but i am using SQLFORM and i am doing everything under the controller, like:

                assignform = SQLFORM(cla, record=clai)
                assignform.vars.class_id = cidi
                opts = assignform.element('select 
#class_assignments_lecture_id')
                for i in range(len(opts)-1,-1,-1):    #decrementing i to 
delete <option...> tags
                    del(opts[i])
                course_id = db(cls.id == cidi).select().first().id
                lectures = db((lec.course_id == course_id) & (lec.order_by 
>= 0)).select(orderby=lec.order_by | lec.title)
                for l in lectures:
                    opts.append(OPTION("%s (%s)" % (l.title, l.id), 
_value="%s" % l.id))
                
opts.update(_onchange=XML("jQuery('#class_assignments_lecture_item_id').empty();
 
ajax('%s', ['lecture_id'], 'class_assignments_lecture_item_id');" % 
(URL(c='main', f='ajaxLectureItems'))))
                opts = assignform.element('select 
#class_assignments_lecture_item_id')
                for i in range(len(opts)-1,-1,-1):    #decrementing i to 
delete <option...> tags
                    del(opts[i])
                opts.append(OPTION("All Segments Original", _value=""))

so, you can see i am doing a lot of massaging the form, mainly the options 
elements and i add the full URL to the ajax function just to make sure it 
gets to the proper function.  and the ajax return is very simple right now, 
just to see if anything makes it back to the page and proper id#:

def ajaxLectureItems():
    return "omg dude"

also tried:

def ajaxLectureItems():
    return OPTION("omg dude", _value="1")

and other permutations, but i am just not getting any return result with no 
errors.  so i think it is in the onchange area somewhere.  using web2py 
1.99.2.  lucas

-- 



Reply via email to