Discussion:
[Erp5-dev] Formulator patch that disables fields on read-only forms
Jacek Medrzycki
2007-05-11 16:04:14 UTC
Permalink
Hi

This is a small Formulator patch that disables (sets as 'not editable')
all fields on read only form (that is, the form without the "Save" button).
Normally, fields on read only forms are editable and users sometimes get
confused when, after entering data, they find there is no way to save it.

The patch is instance-wide for now. I think it should be form-specific,
that is a form should have an entry in "Settings" tab that switches the
functionality on or off. For now, I get Key Error on existing forms
after adding new property to "Settings" tab.

We are also thinking about modifying formulator in a way that makes it
render not editable field as disabled HTML control, not text. Rendering
not editable fields as text has a strange effects sometimes (eg.
checboxes are rendered as 1 or 0).

Regards
Jacek




-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Form.py.ReadonlyFormFieldDisabler.patch
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20070511/a7d0eaaa/attachment.asc>
Jacek Medrzycki
2007-05-12 18:54:44 UTC
Permalink
Well, there are some problems on dialog forms with this patch... we'll
keep working on it.
J.
Jean-Paul Smets
2007-05-13 08:22:40 UTC
Permalink
Hi,

If you need to render all fields as read only, I recommend that you set all
fields to read only.

Another approach is to create a special renderer page template (ex.
something like form_view_read_only). But I do not recomment it because it
is harder to maintain.

Basically, your patch is not the appropriate way because it has various
risks.

Regarding "read only" fields, the rule is that they should be rendered as
HTML text (never as a input widget). It is true that it makes strange
results such as 0 and 1 for checkbox.

If you have a good idea of how to render checkboxes as text, please suggest
it and implement it as a patch in
Products/ERP5Form/FormulatorPatch.py

Please not that it is probably already possible to use CSS to render
checkboxes in a better way (ie. with an icon which depends on the content
of the checkbox for example).

JPS.
Post by Jacek Medrzycki
Hi
This is a small Formulator patch that disables (sets as 'not editable')
all fields on read only form (that is, the form without the "Save"
button). Normally, fields on read only forms are editable and users
sometimes get confused when, after entering data, they find there is no
way to save it.
The patch is instance-wide for now. I think it should be form-specific,
that is a form should have an entry in "Settings" tab that switches the
functionality on or off. For now, I get Key Error on existing forms
after adding new property to "Settings" tab.
We are also thinking about modifying formulator in a way that makes it
render not editable field as disabled HTML control, not text. Rendering
not editable fields as text has a strange effects sometimes (eg.
checboxes are rendered as 1 or 0).
Regards
Jacek
Loading...