Since 'status' is a list:string field, why not set multiple=True?
IS_IN_SET(..., multiple=True)
Anthony
On Monday, October 10, 2011 2:45:48 PM UTC-4, Cliff wrote:
>
> This is the field def:
> Field('status', 'list:string'),
>
> then:
> db.mytable.status.requires = IS_IN_SET(
> {'n': 'New', 'I':'In process', 'C':'Complete'},
> zero = 'Choose'
> )
>
> When editing, SQLFORM shows the zero choice when on opening. The
> choices display correctly and can be changed.
> On the next go round, it shows the zero choice again.
>
> When viewing the object (readonly=True), SQLFORM shows the dictionary
> key, not the value. In other words, it will pick up the 'C' rather
> than showing 'Complete'
>
> I don't think it should matter, but because I'm using a generic form I
> call SQLFORM this way:
>
> return response.render(form=SQLFORM(db.mytable, request.args(0)),
> h1="Edit")
>
> Appadmin does the same thing and complains if I don't change the zero
> value to a value in the dictionary.