Re: Bindings validation messages never reach an NSArrayController subclass
Re: Bindings validation messages never reach an NSArrayController subclass
- Subject: Re: Bindings validation messages never reach an NSArrayController subclass
- From: "Jeremy Higgs" <email@hidden>
- Date: Wed, 19 Apr 2006 21:37:44 +1000
Just to add to my previous email, I tried implementing the
validate<key>:error: method (as described at
http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Validation.html
) at the controller-layer, and it didn't work either. (Then again,
it's model-layer validation method, so I didn't really expect it to
work, anyway!)
I have also looked at mmalc's bindings examples (
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html ) and
while there's an example of validation there, it's at the model layer
and not the controller layer.
Can anyone give me a push in the right direction?
Thanks!
On 4/16/06, Jeremy Higgs <email@hidden> wrote:
> Hi guys,
>
> I'm trying to implement validation for some fields in a tableview
> backed by bindings, but I'm having problems... What I'm attempting is
> to check whether there's an existing item in the array with the same
> name/key, and if so, throw back an error (so there aren't duplicates
> and the existing object isn't clobbered).
>
> I've implemented both of the following methods in a subclass of
> NSArrayController:
>
> - (BOOL)validateValue:(id *)ioValue forKeyPath:(NSString *)inKeyPath
> error:(NSError **)outError;
> - (BOOL)validateValue:(id *)ioValue forKey:(NSString *)key
> error:(NSError **)outError;
>
> ... as well as changing the array controller in the NIB to the custom
> subclass. I have enabled "Validates Immediately" for the table column
> bindings settings, as well on the controller. (I suppose only one of
> them was necessary, and probably have different effects, but neither
> seems to work!)
>
> I've read over the bindings docs (and the "Bindings Message Flow"
> diagrams), and haven't uncovered any problems with how I'm approaching
> this.
>
> Can anyone suggest what I'm doing wrong, or how to implement
> validation at the controller level?
>
> Thanks!
>
> Jeremy
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden