Reputation: 83
I can't understand what is happening. I just want to call PostsController.index() but It doesn't work.
// View/Posts/index.ctp
<?php echo $this->Form->create(false, array('type' => 'post')); ?>
If I comment out this at PostsController.
// public $components = array('Security');
Environment : Cakephp 2.3.8 PHP Version 5.4.7
Updated:
It is enough to be able to use Csrf check, so I modified 'Security' options like below.
public $components = array(
'Security' => array('validatePost' => false),
);
But I still don't understand SecurityComponent behavior...
Upvotes: 0
Views: 309
Reputation: 6047
passing "false" as first parameter is not a good idea. There should be a model name like:
echo $this->Form->create('Post', array('type' => 'post'));
If you want custom action use 'url' parameter:like:
echo $this->Form->create('Post', array('type' => 'post', 'url'=>array('controller'=>'Post', 'action'=>'add'));
Upvotes: 1