I am using the multiselect plugin read and save data from a
crud.create or crude.update form and it just is not working, it seems
to see that there are values there as the field is filled with a "|"
for each option selected. I am not sure what is happening and what I
am doing wrong. Any help would be appreciated.
If I manually fill data into the database and load it using
crud.update(db.testcase_test, testcase_id) it selects the correct
options. I am sure I am missing something stupid and anyone who wants
to point it out would be greatly appreciated.

Here is the database table

db.define_table('testtype',
Field('name', 'string', length=45),
Field('description', 'text'),
Field('recordvalid', 'boolean'),
migrate=False)

db.define_table('testcase_test',
Field('structure', 'string', length=1024,writable=False),
Field('name', 'string', length=255),
Field('description', 'text', length=255),
Field('testmodeid', db.testmode,
requires=IS_IN_DB(db,'testmode.id','testmode.name')),
Field('testtoolid', db.testtool,
requires=IS_IN_DB(db,'testtool.id','testtool.name')),
Field('inputconfigblobid', db.inputblob,
requires=IS_IN_DB(db,'inputblob.id', 'inputblib.localfilename')),
Field('requirementsid', db.requirements,
requires=IS_IN_DB(db,'requirements.id','requirements.name')),
Field('productid',writable=True),
Field('environmentid',writable=True),
Field('commandline', 'string', length=255),
Field('resulttypeid', db.resultstype,
requires=IS_IN_DB(db,'resultstype.id', 'resultstype.resulttype')),
Field('resultunitsid', db.resultunits,
requires=IS_IN_DB(db,'resultunits.id', 'resultunits.unit')),
Field('lowlimit', 'string', length=255),
Field('highlimit', 'string', length=255),
Field('estexectime', 'time'),
Field('lastexectime', 'time', writable=False),
Field('priority','integer',default=-1),
Field('default_priority', 'integer', default=-1),
Field('seqnum', 'integer',default=-1),
Field('testtypeids', 'string'),
migrate=True)
db.testcase_test.structure.label = 'Test Stuite Structure'
db.testcase_test.testmodeid.label = 'Test Mode'
db.testcase_test.testtoolid.label = 'Test Tool'
db.testcase_test.inputconfigblobid.label = 'Test Case Input Config
File'
db.testcase_test.requirementsid.label = 'Test Case Requirements'
db.testcase_test.productid.label = 'Product'
db.testcase_test.commandline.label = 'Test Case Commandline'
db.testcase_test.resulttypeid.label = 'Result Type'
db.testcase_test.resultunitsid.label = 'Result Units'
db.testcase_test.lowlimit.label = 'Low Limit'
db.testcase_test.highlimit.label = 'High Limit'
db.testcase_test.estexectime.label = 'Estimated Execution Time'
db.testcase_test.lastexectime.label = 'Last Execution Time'
db.testcase_test.seqnum.label = 'Sequence Number'
db.testcase_test.testtypeids.label = 'Test Types'
products = db(db.testsuite.parentid==-1)
db.testcase_test.productid.requires = IS_IN_DB(products,
'testsuite.id', 'testsuite.name')
environments = db(db.testenvironment.recordvalid=='T')
db.testcase_test.environmentid.requires = IS_IN_DB(environments,
'testenvironment.id', 'testenvironment.name')
testtypes = db(db.testtype.recordvalid=='T')
db.testcase_test.testtypeids.requires = IS_IN_DB(testtypes,
'testtype.id', 'testtype.name',multiple=True)

Here is the form code:
def test_case():
    form = None
    db.testcase_test.structure.default =
session.testsuite_testsuitestructure
    db.testcase_test.productid.default = session.testsuite_productid
    for row in
db(db.testenvironment.name==session.testsuite_environmentname).select():
        db.testcase_test.environmentid.default = row.id
    #script = SCRIPT("$(document).ready(function() {$
('#testcase_test_testtypeids').multiSelect();} 
);",_language="javascript",_charset="utf-8")
    if len(request.args) > 0:
        if request.args[0] == 'edit':
            testcase_mode = request.args[0]
            testcase_id = request.args[1]
            form = crud.update(db.testcase_test,testcase_id)
    else:
        form = crud.create(db.testcase_test)

    return dict(form=form,session=session)


Here is the view code:
{{extend 'layout.html'}}
<h1>Test Case</h1>
{{=form}}
{{=plugin_multiselect(db.testcase_test.testtypeids)}}
<h2>Submitted variables</h2>
{{=BEAUTIFY(request.vars)}}

<h2>Session variables</h2>
{{=BEAUTIFY(session)}}

Reply via email to