[EMAIL PROTECTED] wrote:
> Hi all,
> is there possibility to dynamically set form field to readonly? I found
> only how to pass desired field name to disabled_fields parameter when
> creating Form instance. But this is not exactly I need.
>
> I need this field which is normally enabled and visible (upon creating
> new record) to be posted to next handler (save or add). But when
> editing is needed, this column must NOT be editable.
>
> Thanks
> Jiri
Pass a disabled attribute when you're displaying an edit page:
>>> from turbogears import widgets as w
>>> form = w.TableForm(fields=[w.TextField(name="hello")])
>>> print form.render(attrs=dict(hello={'disabled':'disabled'}))
<FORM METHOD="post" CLASS="tableform" NAME="form">
...
<INPUT DISABLED TYPE="text" CLASS="textfield" NAME="hello"
ID="hello">
...
</FORM>
Ciao
Michele
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---