weekdays = ("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday") form = SQLFORM.factory(Field('dow',requires=IS_IN_SET(range (1,8),weekdays,multiple=True)))
On Jan 1, 12:32 am, Brian M <bmere...@gmail.com> wrote: > How would I go about creating a select field with SQLFORM.factory that > gives output like this? > > <select name="dow" multiple="multiple"> > <option value="1">Monday</option> > <option value="2">Tuesday</option> > <option value="3">Wednesday</option> > <option value="4">Thursday</option> > <option value="5">Friday</option> > <option value="6">Saturday</option> > <option value="7">Sunday</option> > </select> > > I know that I can do it with regular FORM like this: > > weekdays = [[1,"Monday"],[2, "Tuesday"],[3,"Wednesday"],[4,"Thursday"], > [5,"Friday"],[6,"Saturday"],[7,"Sunday"]] > weekday_options = [OPTION(day[1],_value=day[0]) for day in weekdays] > FORM(SELECT(*weekday_options,**dict > (_name="dow",_multiple='multiple',requires=IS_IN_SET > ([1,2,3,4,5,6,7])))) > > But I can't figure it out with SQLFORM.factory, which I'd like to use > so I can do custom form layouts. (Well, I could do it if the weekdays > were in a db table, but that seems silly). I'm sure I am missing > something simple and obvious. > > ~Brian -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@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.