More precisely, this is how the Pyhton cgi module parses multiple submissions of the same variable (as a list). The reason it does not return a list if you select only one is because of html specs: the cgi module has no way of knowing it is possible to select more than one.
On Jul 7, 11:56 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > This has nothing to do with web2py. This is how HTML was designed and > one of the reasons it sucks. > > web2py FORM.accepts and validators have to just hoops to deal with > things like this. > > Massimo > > On Jul 7, 11:43 pm, "mr.freeze" <nat...@freezable.com> wrote: > > > <input type="checkbox" name="color" value="red">Red<br> > > <input type="checkbox" name="color" value="yellow">Yellow<br> > > <input type="checkbox" name="color" value="blue">Blue<br> > > <input type="checkbox" name="color" value="orange">Orange<br> > > <input type="checkbox" name="color" value="green">Green<br> > > <input type="checkbox" name="color" value="purple">Purple<br> > > > If I check more than one item request.vars.color is a list > > If I check only one item request.vars.color is a string > > > It's easy enough to type check it but was just curious if it is by > > design. It threw me off because my loop that was returning single > > letters when I selected only a single item :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---