[html-formfu] Constraints - Dynamic,
RequiredWhen or extending Constraint and _others
mario.minati at googlemail.com
Wed Sep 19 11:14:27 GMT 2007
On Tuesday 18 September 2007 12:50:23 Carl Franks wrote:
> On 16/09/2007, Mario Minati <mario.minati at googlemail.com> wrote:
> > Hi Carl,
> > a few days ago I posted a Dynamic constraint with the idea of a
> > constraining a textfield depending on the value of a different field, e.
> > g. a select field.
> > Today I needed to constrain many textfields depending on a radiogroup, as
> > this radiogroup decides which fields needs to be filled, so I could put a
> > required constraint on these fields.
> > This bought me to the idea of extending 'process' in constraint and
> > _others class (these are the base classes for al constraints) with a
> > 'when' accessor and the code to only run the constraint when a specific
> > field contains a given value (or the value is in a given range).
> > I would suggest the following structure:
> > - Required
> > when:
> > - field: name
> > - value: 1
> minor nit-pick - that would be:
> - type: Required
> - field: name
> - value: 1
> > or
> > - values: [ 2, 4, 6 ]
> > What do you think?
> Yeah, that sounds good, go for it!
In SVN including docs and tests.
More information about the HTML-FormFu