I used the following:

record = db(db[main_data.settings.table_name_products].id ==
product_id).select()
form.element(_id = "op_products_type")[0] = record[0].type

Regards,

Oscar.


On 12 jun, 01:33, Oscar <[email protected]> wrote:
> Hi,
>
> I have a model using a list:string field called type.
>
> Validation for type field:
> IS_IN_SET({'finished':T('Finished'),'service':T('Service')},
> zero=T("-- Choose Type Of The Product --"))),
>
> So, when I create an update form using SQLFORM it shows the form fine
> but, the dropdown thats belong to type doesn't have the right value or
> selection, it just shows "-- Choose Type Of The Product --"
>
> form = SQLFORM(db[main_data.settings.table_name_products],
>                    record = product_id,
>                    fields = product_fields,
>                    submit_button = submit_button,
>                    formstyle = 'divs')
>
> I need that type field get the right value from the string stored in
> the DB to get it showed in the dropdown. How I can do this?
>
> Regards,
>
> Oscar.

Reply via email to