我有這種形式在我的HTML:HTML形式返回在Firefox和IE什麼(OK在Chrome)
<form action="/vcontent?topic={{ topic.name }}" method="post">
{% if user and user.email in c.users_up %}
<input type="image" src="icons/thumb-up.png" alt="Up!" name = "vote" value = "up" />
{% else %}
<input type="image" src="icons/thumb-up_gray.png" alt="Up!" name = "vote" value = "up" />
{% endif %}
{% if user and user.email in c.users_down %}
<input type="image" src="icons/thumb-down.png" alt="Down!" name = "vote" value = "down" />
{% else %}
<input type="image" src="icons/thumb-down_gray.png" alt="Down!" name = "vote" value = "down" />
{% endif %}
<input name= "content_key" type="hidden" value="{{ c.key.urlsafe() }}">
</form>
當我嘗試給予好評Chrome版的內容,它工作正常。當我得到的價值:
vote = self.request.get('vote')
我得到「向上」或「向下」,因爲它應該是。
但是,當我在IE和Firefox上做同樣的事情時,我得到一個空字符串。
(HTML中的if/else語句表示如果用戶還沒有對該特定內容進行投票,該圖標顯示爲灰色,否則爲黑色)。
我正在使用Jinja2作爲模板引擎的Google App Engine上。
您知道' mplungjan
是的,它的工作原理就是這樣。這是一個按下時提交表單的圖標。但它應該與投票=「上」或投票=「下」,而不是與投票=「」。 –