plone / plone.supermodel

Provides XML import and export for schema interfaces based on zope.schema fields
5 stars 8 forks source link

naming frustrations & property confusions ... #22

Open iham opened 7 years ago

iham commented 7 years ago

i dont know, if its better to mentioned in zope.schema or plone.autoform or here:

setting a field to readonly - field gets hidden. setting a field to display - field gets hidden, value is shown.

i would have expected, to see the field, but loose ability edit when setting readonly. because you know ... readonly somewhat tells me, i can read the field and be not able to edit it.

directive.mode - display sort of does that, but i would prefer a field, inside its value and not be able to edit the content of the field.

thet commented 7 years ago

@iham plz post the relevant code snippets

iham commented 7 years ago
position = schema.TextLine(
        title=u'Position',
        readonly=True,
        default=u'',
        required=False,
)

does hide the field on edit-form.

position = schema.TextLine(
        title=u'Position',
        default=u'',
        required=False,
)
directives.mode(position='display')

does make the field "readonly" - data is shown on edit-form

it is irritating to make a field readonly and NOT be able to visually read it (i guess data-access is still working - but thats not my point). thats confusing me

iham commented 7 years ago

i would have assumed, on readonly=True, i'll get a readonly input field with value (if existing).

davisagli commented 7 years ago

readonly is an attribute from zope.schema that existed before any particular form library. I agree that we missed doing the right thing with it and that your expectation makes sense; it would make sense for the form library to interpret it in a similar way to setting the mode to display. However, changing it at this point might have the unfortunate effect of causing fields to appear that were previously hidden.