On Feb 22, 4:37 pm, Niphlod <[email protected]> wrote:
> Hi, am I missing something or custom widgets when field is not
> writable ends up to be forgotten (i.e. default string representation
> is done on these fields)?
>
> I'm using something like:
>
> #controller
> record = db.mytable[1]
> record.textfield.readable = False
this should read: db.mytable.textfield.readable = False
> record.textfield.widget = my_widget
similarly here: db.mytable.textfield.widget = my_widget
> form = SQLFORM(db.mytable, record):
> ................
>
> and
>
> #view
> {{=form.custom.begin}}
> {{=form.custom.widget.textfield}}
form.custom.widget.textfield will be None
when db.mytable.textfield.writable = False
since writable=False means "don't show in input (create/edit) forms";
readable=False means "don't show in output (display) forms".
> {{=form.custom.submit}} {{=form.custom.end}}
>
> any simple workaround ?
db.mytable.textfield.writable = True