No, you should not get a series of select boxes, just a single multi-select
box, like
this: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select_multiple.
The book states that a list:reference field "produces a SELECT/OPTIONmultiple
drop-box".
Anthony
On Wednesday, September 7, 2011 3:43:11 PM UTC-4, monotasker wrote:
>
> In a form generated by SQLFORM I'm finding that a list:reference field
> is represented with a single list-box. What I expected based on the
> section on list:<type> in the manual was a series of select boxes. Was
> I reading the manual wrong? If not, does anyone know why I might be
> getting the wrong widget presented?
>
> Here is the relevant part of my model:
>
> db.define_table('tags',
> Field('tag', 'string'), format='%(tag)s')
>
> db.tags.tag.requires = IS_NOT_IN_DB(db, db.tags.tag)
>
> db.define_table('questions',
> Field('question', 'text', required=True),
> Field('answer', 'string', required=True),
> Field('score', default=1, required=True),
> Field('answer2', 'string', default='null'),
> Field('score2', 'double', default=0.5),
> Field('answer3', 'string', default='null'),
> Field('score3', 'double', default=0.3),
> Field('readable_answer', 'string', default='null'),
> Field('tags', 'list:reference tags'),
> Field('nt_frequency', 'double'))
>
> db.questions.tags.requires = IS_IN_DB(db, 'tags.id', db.tags._format,
> multiple=True)
>
> And here is the controller that creates the form:
>
> def create_question():
> form = SQLFORM(db.questions)
> if form.accepts(request.vars, session):
> response.flash = 'form accepted'
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill out the form'
> return dict(form=form)
>
>