Hi,
I found that the action is called twice on server side.
The model has been purged of any relation and callback methods and validation options. Some day ago I either asked about an error with $this->redirect(), which is still present. It causes a "Controller `Controller` missing", but maybe a different issue.
I really don't know.. :(

Thank in advance.

AppController.php

    public function add() {
        $this->edit();
        $this->render("edit");
    }


PeopleController.php

public function edit($id = null) {
        if ($this->request->is('post') || $this->request->is('put')) {
            /// @TODO: why is edit() called twice?
            /// second time with empty request data
            if(count($this->request->data) == 0) {
                // $this->redirect( $this->referer() ); // causes loop!!!!
                $this->redirect( "/people/index", 200, true );
            }

            $result = $this->Person->save($this->request->data);
//            krumo($this->request, $result, $this->Person);

            if ($result) {
                $this->Session->setFlash(__('The person has been saved'));
                $this->redirect( array('action' =>  'index') );
            } else {
                $this->Session->setFlash(__('The person could not be saved. 
Please, try again.'));
            }
        }
  // common stuff, read&  set data
}



Il 16/03/2012 14:01, Allan Douglas ha scritto:
Show the action code.

2012/3/16 luca capra<[email protected]>:
Hi,
I got a form loaded via ajax request, then posted via ajax too on 2.1
The data is saved in the database but save() method return false.

What could be the cause?

Thank you

--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org Check out the new CakePHP Questions site
http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php



--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to