how to write event handler for dropdown list

M

mc.pandey

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 !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top