Zeynel
Zeynel

Reputation: 13525

How to collect values from checkbox in App Engine (python)?

I found an article for CherryPy and some articles on how to do this with Javascript, but is there a way to collect values from checkbox with webapp? Thanks.

My naive attempt to append the <...name="article_tag"...> from the form to a list fails because it only writes the first checked item (in this case "sputnik"):

K = []
for i in range(1,5):
    K.append(self.request.get("article_tag"))
    self.response.out.write(K)
    logging.info("""*****K %s""" % K) 

logging.info:

*****K [u'sputnik', u'sputnik', u'sputnik', u'sputnik']

Upvotes: 1

Views: 1173

Answers (1)

Zeynel
Zeynel

Reputation: 13525

I found the answer: http://code.google.com/appengine/docs/python/tools/webapp/requestclass.html#Request_get_all

K = self.request.get_all("article_tag")

Upvotes: 2

Related Questions