auto mail when...">

How to get checkbox data using python on gae

This is my HTML:

<div id='automail'>
    <form action = "/admin/mail" method = "get">
        auto mail when user :<br/><br/>
        <div>
            <input type="checkbox" name="automail" value ="signup">signUp</input><br/>
            <input type="checkbox" name="automail" value ="login">login</input><br/>
        </div>
        <div style="text-align:right">
            <input type="submit" value="save"></input>
        </div>

    </form>
</div>

And this is my python descriptor:

class mail(BaseRequestHandler):
    def get(self):
        all=self.request.get('automail')
        if not all:
            self.response.out.write('sss')
            return
        self.response.out.write(all)

when I select 'signup' and 'login', it only shows 'signup'.

So how to get all the data from a checkbox using python on gae?

update:

this is now normal in two ways:

1. all=self.request.get_all('automail')

2.  all=self.request.get('automail',allow_multiple=True)

+3
source share
1 answer

If multiple arguments have the same name, self.request.getreturns the first.

You want get_all .

+6
source

Source: https://habr.com/ru/post/1753531/


All Articles