[html-formfu] Constraints - Dynamic, RequiredWhen or extending Constraint and _others

Mario Minati mario.minati at googlemail.com
Sun Sep 16 20:18:49 GMT 2007

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
    - field: name
    - value: 1
    - values: [ 2, 4, 6 ]

What do you think?


More information about the HTML-FormFu mailing list