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

2010-05-25 Thread Simon Elbaz
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
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


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

2010-05-25 Thread Simon Elbaz
Hi,
I use the following interface:

class ILettrage(IRecord):
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.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['invoice_to_write'].widgets[0].subform.widgets['t_invoice_ref'].mode
= DISPLAY_MODE
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users