Hi 

> Betreff: Re: [Zope3-Users] Cloning interfaces/interface fields - how?

[...]

> > > So yes, you need to change it on the widget level; here 
> is what you 
> > > have to do in your form:
> > >
> > > class MyForm(Form):
> > >
> > >   def updateWidgets(self):
> > >     super(MyForm, self).updateWidgets()
> > >     self.widgets['prefix.myfield'].required = False
> > >
> > > Is that too difficult still?
> >
> > Does that actually work?  I vaguely seem to remember that I 
> tried this 
> > approach once (making the widget not required when the field was 
> > required), but some code from the field itself raised 
> validation errors.
> 
> Heh, this was also my first reaction on this as I also 
> received such an error some time ago but could not really 
> remember if it was my fault or not, but as you mention it, 
> too, there seems to be some problem. ;-)

If you define a field as requeried it's required. Because
the form widget validation calls it's own form validation
AND the field validation.

This means it's not possible to store None values
for a field which are required without quirks.

Note:
required=True in fields allows you to define
what the missing_value is. You can store empty strings
on such fields if you define missing_value=None.

Then a empty string should not end in missing input.
Beacuse it compares "if value = field.missing_value".

Regards
Roger Ineichen

> Regards,
> Hermann
> 
> --
> [EMAIL PROTECTED]
> GPG key ID: 299893C7 (on keyservers)
> FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
> 

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to