how to write event handler for dropdown list

mc.pandey at gmail.com mc.pandey at gmail.com
Fri Nov 23 12:43:31 CET 2007


Hi,

I am new to python,
Can someone help me with writing event handler for a dropdown list in
python.

i have one function to create dropdown list in a file

def dropdown_options(self,title,options,name,value = None):
        ret = "\n<span class = \"title\">"+ title.title() + "</span>
\n"
        if (options != []):
            ret += "<select id = \"sel\" name = "+name+">\n"
            for i in options:
                if (value != None and str(value) == str(i[0])):
                    ret += "<option selected = \"1\" value =
\""+str(i[0])+"\">"+str(i[1])+"</option>\n"
                else:
                    ret += "<option value = \""+str(i[0])
+"\">"+str(i[1])+"</option>\n"
            ret += "</select>"
        else:
            ret += "No options available for this item"
        return ret

and i am calling this from another file

ret += ui.dropdown_options("Project",db.getprojects(user),"proj") +
ui.linebreak()

Now i want to do some activity when i select diffrent options from the
dropdown list.

Any help is appreciated !!



More information about the Python-list mailing list