[Zope3-Users] How to make a field not modifiable ?

Simon Elbaz elbazsimon9 at gmail.com
Tue May 25 17:56:57 EDT 2010


Hi,

> Sorry my previous mail was incomplete.



> I use the following interfaces:
>

*********************************************
class IRecordLettree(zope.interface.Interface):

     t_sub_ref = zope.schema.TextLine(
    title=u"Sub Ref.",
    required=True)

class ILettrage(zope.interface.Interface):
>     record_to_write = zope.schema.List(
>         title= u'Record to write',
>         description = u'Records written',
>         required=False,
>         value_type = zope.schema.Object(schema=IRecordLettree)
>     )
> ******************************************
> This interface is used in a z3c.form:
>
> class LettrageEditForm(form.EditForm):
>     form.extends(form.EditForm)
>     fields = field.Fields(ILettrage).select('t_record_ref',
> 'record_to_write')
>
>     def updateWidgets(self):
>         super(LettrageEditForm, self).updateWidgets()
>         self.widgets['t_record_ref'].mode = DISPLAY_MODE
> self.widgets['record_to_write'].widgets[0].subform.widgets['t_sub_ref'].mode
> = DISPLAY_MODE
>
**********************************************

When I click on the Apply button, I get the following error:
There were some errors.

   - Record to write:
   Constraint not satisfied

while t_sub_ref was previously filled.

The goal is to make some fields of the subobject not modifiable in the edit
form (without using read-only attribute in the interface).

How could I achieve that?

Thanks for your help
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20100525/42695c80/attachment.html 


More information about the Zope3-users mailing list