Answer:
You can't change the drop down with scaffolding. "It uses
generateList to get the listing - so there is no way with scaffoling -
to tell it to exclude the current item." said ChrisPartridge on IRC.
You can apply some extra validation to the model with function
beforeValidate() { if($this->data[$this->name][$this->primaryKey])
{ if($this->data[$this->name][$this->primaryKey] == $this->data[$this-
>name]['parent_id']) { $this->invalidate('parent_id'); } } }.
Also said Chris,
Thanks,
Michael
On Jul 3, 4:41 pm, "Michael McAndrew" <[EMAIL PROTECTED]>
wrote:
> PS. When I say prevent, I'm refering to stopping the section still
> appearing in the parent down drop down box on its own edit page.
>
> On 7/3/07, michaelmcandrew <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi, I have a belongs to condition that applies to a Section model that
> > references itself for its parents. I
>
> > var $belongsTo = array(
> > 'Parent' => array(
> > 'className'=>'Section',
> > 'foreignKey'=>'parent_id',
> > )
> > );
>
> > I want to be able to stop a parent being its own child. I thought
> > adding the following condition would prevent that.
>
> > 'conditions'=>'Section.parent_id'!=Parent.id'.
>
> > But it doesn't. Can anyone tell me what I am doing wrong?
>
> > Thanks,
> > Michael
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---