From: ramon.leon(a)allresnet.com
To: smallwiki(a)iam.unibe.ch
Subject: RE: Magritte question
Date: Sat, 8 Sep 2007 13:46:46 -0700
Thank you for your help.
Now I have another problem :
buildEditorFor: anItem
^(anItem description copy
addCondition: [:memento | (Item repository
contains: [:each | memento model id = each not]) not]
labelled: 'An item with that id already exists';
asComponentOn: anItem)
addValidatedForm;
yourself
The memento model id doesn't change it's value when I edit
it. I saw MACheckedMemento has a #cache and a #original
method, maybe I should use them, but I don't know how.
Sebastien
That's because the memento doesn't write to the model until after it passes
all its validations. You need to check the pending values, which are in the
memento keyed by your descriptions. You don't want to say "memento model
id" in your rule, you want to say "memento cache at: YouModel
descriptionId"
to see it's pending value.
Ramon Leon
http://onsmalltalk.com
_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_________________________________________________________________
Créez un blog Messenger pour partager facilement toutes vos photos de vacances !