本文介绍了如何在Google App Engine中使用python获得html select选项的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在使用Google App Engine开发Web应用程序。我正在使用Python运行时环境。我也使用Jinja2框架。我的问题是这样的:在我的html页面中,我在表单中有以下标记:

I am working on a web application using Google App Engine. I am using Python Runtime Environment. I am also using Jinja2 framework. The problem I have is this: On my html page, I have the following markup inside a form:

 <select name="word" class="span4">
      <option value="authors" selected>Authors</option>
      <option value="blogs">Blogs</option>
      <option value="bloggers">Bloggers</option>
      <option value="ebooks">Ebooks</option>
      <option value="author">Author</option>
      <option value="writers">Writers</option>
      <option value="kindle">Kindle</option>
 </select>

切换到使用< select option> ,我正在使用< input type =text.... /> ,并且在Python中获取输入值非常简单:

Before switching to using <select option>, I was using <input type="text"..../> and getting the input value inside Python was as simple as :

def post(self):
    word = self.request.get('word')

但现在我无法使脚本工作,因为我无法从用户提交的表单中访问所选值。请帮忙,因为我环顾四周,找不到任何清楚的东西!
谢谢,我期待您的帮助!

but now I cannot get the script to work because I cannot access the selected value from the form submitted by the users. Please help because I have looked around and couldn't find anything clear!Thank you and I look forward to your help!

推荐答案

您可以使用

you can use

self.request.get_all('word')

这篇关于如何在Google App Engine中使用python获得html select选项的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 22:03