I've just switched to MySQL to see if it was a SQLite error, but it persists:
<class '_mysql_exceptions.OperationalError'> at /users/ (1241, 'Operand should contain 1 column(s)') Python /usr/lib/python2.7/site-packages/MySQLdb/connections.py in defaulterrorhandler, line 35 -- Tomás Schertel ---------------------------------------------- Linux Registered User #304838 Arch Linux User http://www.archlinux-br.org/ ---------------------------------------------- On Sat, Oct 22, 2011 at 18:16, Tomás Acauan Schertel <[email protected]>wrote: > Sorry [email protected], but I didn't find any other message from this > address. > Jian, I have a form with three checkbox fields. Here they are: > > <input type="checkbox" name="groups" > value="administradores"/>Administradores<br /> > <input type="checkbox" name="groups" value="operadores" />Operadores<br /> > <input type="checkbox" name="groups" value="usuarios"/>Usuários<br > /> > > I submit this form to a simple function that reads form's information and > record this information to a database. > > def POST(self): > i = web.input(groups = []) > db.insert("users", email = i.email, name = i.name, groups = > i.groups) > raise web.seeother('/users/') > > When I submit the form, I get this error in browser: > > <class 'sqlite3.InterfaceError'> at /users/ > Error binding parameter 3 - probably unsupported type. > > Python /usr/lib/python2.7/site-packages/web/db.py in _db_execute, line 586 > > And get this error in terminal: > InterfaceError: Error binding parameter 3 - probably unsupported type. > > > If I change this line "i = web.input(groups = [])" to "i = web.input(groups > = {})", it partially works. Partially because I just get the value of the > last checked checkbox and not all checkboxes. > > If I change db.insert to groups = str(i.groups), I get all values, but this > inserts "[u'administradores', u'operadores']" to database. > > I'd like to see "administradores operadores" in database. > > If anyone could help me, I'd appreciate. > > > > -- > Tomás Schertel > ---------------------------------------------- > Linux Registered User #304838 > Arch Linux User > http://www.archlinux-br.org/ > ---------------------------------------------- > > > On Sat, Oct 22, 2011 at 13:05, <[email protected]> wrote: > >> ** Hi Jian, i recently posted a working solution. Don't have good >> internet access now, but search for my username in this forum and you'll >> find it. >> ------------------------------ >> *From: * Jian Chang <[email protected]> >> *Sender: * [email protected] >> *Date: *Sat, 22 Oct 2011 22:32:01 +0800 >> *To: *<[email protected]> >> *ReplyTo: * [email protected] >> *Subject: *Re: [webpy] Anyone using checkboxes in forms?? >> >> plz show some examples. >> >> 2011/10/21 Tomás Acauan Schertel <[email protected]> >> >>> I still don't know how to use checkboxes in webpy. >>> I always get just the value from last checked box . >>> >>> >>> -- >>> Tomás Schertel >>> ---------------------------------------------- >>> Linux Registered User #304838 >>> Arch Linux User >>> http://www.archlinux-br.org/ >>> ---------------------------------------------- >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "web.py" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/webpy?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "web.py" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/webpy?hl=en. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "web.py" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/webpy?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
