What about adding a "validateChildren" property in
MAToOneRelationDescription, to perform that validation just when I want?
Cheers,
Esteban
On 2008-07-16 16:37:28 -0300, Lukas Renggli <renggli(a)iam.unibe.ch> said:
On Jul 16, 2008, at 17:40 , Esteban Lorenzano wrote:
> Hi,
> I'm using MAInternalEditorComponent for editing some complex
> structures
> and for now is working ok, but I found a little issue. Take this
> example:
> I have a Person, who has an Address. I edit Person for create a new
> instance, then I run validation for the component... and validation
> does not validate Address, just it's existence, which obviously exist,
> because I created it with a #default:, but required values for #street
> and #number are not chequed.
>
> I solved this problem by oberriding #validateSpecific: of
> MAToOneRelationDescription this way:
>
> validateSpecific: anObject
> super validateSpecific: anObject.
> anObject description validate: anObject.
>
> My question is: is this solution correct? this is maybe a bug of
> magritte?
The problem is that when using an MAInternalEditorComponent you want
the validation you added. When using an MAExternalEditorComponent you
don't want it though, as the model already validated in the external
editor. Otherwise you run into strange bugs.
Frankly I never use (or used) these internal and external editors in
productive applications. This seems simply to complicated to make it
work in properly in all situations. When it comes to relationships I
usually do write some glue code by hand. Often this turns out more
user-friendly than an generated form too.
Cheers,
Lukas