Hi,
You can add global conditions to the formula for that.
The following example adds 2 fields and checks if their values are the
same.
formula := ILFormula on: aModel.
formula inputOn: #foo.
formula inputOn: #bar.
formula addCondition: [:model |
model foo = model bar]
Note that the model parameter in the condition block is in fact a proxy,
not the model itself. It will be committed to the model only if all
conditions are validated.
HTH,
Nico
Le vendredi 25 mars 2011 à 18:24 +0100, AxiNat a écrit :
> Hi list,
>
>
> Imagine I have to validate a field depending on another field, like in
> the following example:
>
>
> |anObject|
> formula := ILFormula on: anObject.
> (formula inputOn: #whatever).
> (formula inputOn: #something)
> addCondition: [:v | v hasSomethingToDoWith: anObject
> whatever].
>
>
> I understand the non-triviality of the problem, as anObject isn't
> complete until the form is submitted. However, my case really requires
> one field to be validated against another... is there a way to
> implement such behaviour in Formula?
>
>
> Thanks again!
>
>
> Bernat Romagosa.