On Thu, 2008-08-28 at 22:55 +0100, Martin Aspeli wrote: > Hermann Himmelbauer wrote: > > Am Donnerstag 28 August 2008 02:35:28 schrieb Marius Gedminas: > >> On Wed, Aug 27, 2008 at 05:15:48PM -0700, Stephan Richter wrote: > >>> On Wednesday 27 August 2008, Martin Aspeli wrote: > >>>> This means that if the request contains the empty-marker only (no > >>>> selection was made) for a checkbox widget (say), then the return value > >>>> is , rather than default (NOVALUE). > >>>> > >>>> Is that a bug? I have a custom checkbox widget derived from the > >>>> standard checkbox widget, (z3c.formwidget.query, in fact), and I never > >>>> get any "required missing" exceptions, even when I untick all the > >>>> checkboxes and click OK. > >>>> > >>>> Am I missing something? > >>> I think you have a point. Have you tried changing the behavior to > >>> return "default" and see what tests fail? If no major failures come out > >>> of this, I would say change it. > >> Wait a second, maybe I'm misunderstanding this, but I certainly oppose > >> any change that would make an unchecked checkbox an error during form > >> validation. > >> > >> A required Bool field can have two values: True or False. One is > >> represented by a checked checkbox, the other by an unchecked checkbox. > >> An unchecked checkbox is not missing input and should not trigger > >> "required missing" errors. > > > > I see this the same way - in my application I have a similar case (Accept > > some > > policy by a checkbox-click). I solved this simply by checking the value in > > the action handler and raising a WidgetExecutionError if it is unchecked. > > The notion of a "required" boolean field is a bit weird anyway.
I remember Windows UI introducing 3-state-checkboxes back in ... uuh ... I think I saw it with Delphi 2. They had the ability to say unchecked, checked and grey meaning: the user didn't say anything. > I think you *could* interpret it so that a boolean field that's required > really means "you have to tick this box" (e.g. an "I agree to these > terms and conditions" type scenario). > > To put it the other way - how would you have a non-required boolean > field represented by a checkbox? You really need three states then: True > False and None, which you can't get with a checkbox. Actually that shouldn't be None. It's more that the attribute wouldn't be set in the first place as None can't be globally used as a marker for 'no user input'. Christian -- Christian Theune · [EMAIL PROTECTED] gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1 Zope and Plone consulting and development
Description: This is a digitally signed message part
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )