drop down menu

How to get selected items from Webpy dropdown  #angularjs #reactjs

  • Once again, thank you very much for your help – Nan Ma 4 hours ago
  • Stack Overflow works best with JavaScript enabled
  • no matter what I select, print s will give None – Nan Ma 8 hours ago
  • Just serialize the form and send that info.:
  • Join the Stack Overflow Community

I’m new to the Webpy. Currently, I have trouble to retrieve the items selected in the Dropdown menu and I haven’t seen any help on it. Could anyone show me how to solve the problem?

@ng_real_ninja: How to get selected items from Webpy dropdown #angularjs #reactjs

import web import pdb from matching_tester import * def make_text(string): return string class tutorial: def GET(self): form = my_form() return render.tutorial(my_form(), “Your text goes here.”) def POST(self): form = my_form() form.validates() s = form.d.Devices print s return make_text(s) if __name__ == ‘__main__’: urls = (‘/’, ‘tutorial’) render = web.template.render(‘templates/’) app = web.application(urls, globals()) my_form = web.form.Form( web.form.Dropdown(‘Devices’, [(‘1’, ‘iPhone 4’), (‘2’, ‘iPhone 4S’), (‘3’, ‘iPhone 5’)], web.form.notnull, **{‘multiple’:None, ‘size’: 4}), web.form.Dropdown(‘Country’, [(‘1’, ‘All’), (‘2’, ‘US’), (‘3’, ‘JP’)], web.form.notnull, **{‘multiple’:None, ‘size’: 4}) ) app.run()

=== tutorial.html === $def with (form, text) Python and AJAX tutorial for beginners with webpy and jQuery



Thank you very much. I was spending hours on it. Just one more question. So far, if I select multiple entries, I only got one at the python script. How I can get an array of inputs from the dropdown? – Nan Ma 7 hours ago

Problem solved. Once again, thank you very much for your help – Nan Ma 4 hours ago

drop down menu

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.