[Seaside] [Magritte] Multiple descriptions validation/condition

Humber Aquino humberaquino at gmail.com
Tue Nov 14 03:27:02 UTC 2006


Thanks Ramon! It works great!!

One last question about conditions. How can i override the default
message for beRequired? When i add a custom condition i specify it
with the labelled: argument.

Or maybe better.. give localizated messages.. am i asking too much? xD

Thanks again

P.D.: onsmalltalk.com it's great! Awesome writing :D

On 11/13/06, Ramon Leon <ramon.leon at allresnet.com> wrote:
> > 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..
>
> descriptionContainer
>     ^(super descriptionContainer)
>         addCondition:
>                 [:value |
>                 (value cache at: self descriptionStartDate)
>                     < (value cache at: self descriptionEndDate)]
>             labelled: 'Start date must be before end date';
>         yourself
>
> Ramon Leon
> http://onsmalltalk.com
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


More information about the Seaside mailing list