MAInternalEditorComponent and validation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

MAInternalEditorComponent and validation

EstebanLM
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?

Thanks,
Esteban



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: MAInternalEditorComponent and validation

Lukas Renggli-2

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

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: MAInternalEditorComponent and validation

EstebanLM
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 <[hidden email]> 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




_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki