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)

Reply via email to