[Seaside] [Magritte] Multiple descriptions validation/condition

Ramon Leon ramon.leon at allresnet.com
Mon Nov 13 17:33:22 UTC 2006

> Hi everyone!
> I have a question about validating models with Magritte.
> When i add a condition to a magritte's description, the 
> condition references the value. For example:
> SomeClass class>>descriptionFoo
>   ^ (MAStringDescription
>             auto: 'foo
>             label: 'Foo'
>             priority: '10')
>               addCondition: [:value | some value checking]
>               labelled: 'Invalid something';
>               yourself.
> In SomeClass i have many descriptions and i want to do some 
> validations combining two or more descriptions.
> I don't know if this is the way to do this.
> Thanks in advance :D

I just learned this one myself, you put the rule on the container
description using the other descriptions as the key into the value cache
like so..

    ^(super descriptionContainer)
                [:value | 
                (value cache at: self descriptionStartDate) 
                    < (value cache at: self descriptionEndDate)]
            labelled: 'Start date must be before end date';

Ramon Leon

More information about the Seaside mailing list