On Wednesday 20 February 2008, Hermann Himmelbauer wrote:
> Yes, I also use z3c.form, but my problem is that the field has the
> "required" flag set to "True", which is appropriate for an add/edit form
> but may not be appropriate for a search form.
> If I change the "required" flag on the field level, e.g. in the update()
> method, the change is permanent in the interface, which is not appropriate.
> And changing it on the widget level seems to be very complicated, at least,
> I found no way to do it.

Mhh, I think that form fields should support this. Let me look at the code 

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?

Stephan Richter
Web Software Design, Development and Training
Google me. "Zope Stephan Richter"
Zope3-users mailing list

Reply via email to