(GMT -6): USA Central, Belize, Canada Central, Costa Rica, Mexico, Nicaragua
Recent Comments
Posted 02/05/2007 08:09am
First, all of my working examples are still in development. Also please note that behaviors are not functional in 1.1.x.x. I am using the trunk of 1.2.x.x for my development.
Second, this particular article does not explain how to display tags in views. It only deals with adding tags and editing tags so that they are stored in your "posts" table and in your "tags" table. This allows for the greatest amount of flexability when displaying tags in your views.
Third, beforeSave function calls are done in sequence, so you can have a beforeSave in your behavior and have a model with a beforeSave. As long as each one returns true, it will save properly, however I am not sure which beforeSave is executed first.
Yeah, I get that it's 1.2 only - all Behaviors are. I should have made my question clearer - of course I'm not trying to implement the Behavior in a view; my question was how does this interact with the view of my add/edit forms?
It looks like you've added some controller logic and sample views to the article; I'll give those a shot. Thanks!
Do you have a working example of this posted somewhere? I'm a little confused as to how to implement this in my views - is the entry field a text input? Would this Behavior conflict with any other Behaviors using a beforeSave function?
I often use select lists with "empty"=>true (which prepends an empty option to the list). If the field I'm trying to write to is an INT and also accepts a NULL value, Cake will try to insert an empty string (''). I made this tweak to the Null behaviour to fix that:
Yeah, I get that it's 1.2 only - all Behaviors are. I should have made my question clearer - of course I'm not trying to implement the Behavior in a view; my question was how does this interact with the view of my add/edit forms?
It looks like you've added some controller logic and sample views to the article; I'll give those a shot. Thanks!
//unset($model->data[$model->name][$field]);
$model->data[$model->name][$field] = NULL;