Guys I already tried those changes, whether I add $this->Project->id
and $this->Project->read(null,$id) , still have the same problem

On Mar 16, 6:55 am, "GMail" <[EMAIL PROTECTED]> wrote:
> I think you have a typo
>
>         function admin_toggleactive($id = null){
>
>                 if (!$id) return;
>
>                 $this->layout = 'ajax';
>                 $this->autoRender = false;
>
>             $this->Project->id = $id; // And not $this->id = $id
>
>                 $project = $this->Project->read();
>
> > -----Messaggio originale-----
> > Da: [email protected]
> > [mailto:[EMAIL PROTECTED] Per conto di [EMAIL PROTECTED]
> > Inviato: venerdì 16 marzo 2007 7.44
> > A: Cake PHP
> > Oggetto: savefield woes
>
> > Quick question:
>
> > I have this function to toggle an 'active' field un a project model,
>
> >    function admin_toggleactive($id = null){
>
> >            $this->layout = 'ajax';
> >            $this->autoRender = false;
>
> >            if ($id) {
> >                $this->id = $id;
> >            }
> >            if (!$this->id) return;
>
> >            $project = $this->Project->read();
> >            if($project['Project']['active']=='1'){
> >                    $this->Project->saveField('active','0');
> >            }
> >            else{
> >                    $this->Project->saveField('active','1');
> >            }
>
> >            $this->data = $this->Project->read();
> >            $this->render('../elements/project_set_unset_active');
>
> >    }
>
> > Now this wont work, the data returned to the element is the
> > same data (without the field toggled). BUT if I replace this line
>
> > $this->data = $this->Project->read();
>
> > to
>
> > $this->data = $this->Project->findById($id);
>
> > the element will be rendered with the new data (the actual
> > value of the toggled field).
>
> > Why does this happen ? Is this the only way to work around this?


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to