[MA] Error handling in MADateDescription componentClass

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

[MA] Error handling in MADateDescription componentClass

Thomas Fischer
Hi,
in a MADateDescription I set a component class derived from MATextInputComponent.
The renderEditorOn: methode split the Date in day, month and year and store this parts as instance variables. Then the methode create the input fields for DD MM YYYY and a hiddenInput:
        html hiddenInput callback: [
                self value: (Date fromString:
                        month asString, '.',
                        day asString, '.',
                        year asString
                ).
        ].

Its works fine, but now I like to add a error handling to deal with invalid dates like "30.02.2007".
In other cases I use the MADescription>>addCondition, but in this case I have no access to the three parts of Date (DD MM YYYY) ...

... error in reasoning?

salute
Thomas
Reply | Threaded
Open this post in threaded view
|

Re: [MA] Error handling in MADateDescription componentClass

Lukas Renggli-2
> In other cases I use the MADescription>>addCondition, but in this  
> case I
> have no access to the three parts of Date (DD MM YYYY) ...
>
> ... error in reasoning?

This is difficult, as you try to validate a different object (a date)  
than the one you edit (the numbers DD, MM, and YYYY). I don't say its  
impossible, but if possible it will be a big hack.

You could try to intercept the validation from your editor/viewer or  
you take a different object (one with the tree numbers) that you edit  
and then convert it when pushing it into the model (for example by  
using special accessor methods).

Cheers,
Lukas

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



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