【发布时间】:2015-06-12 11:40:00
【问题描述】:
我在 CakePHP 2 中制作的表单有问题。
表单提交工作正常,但后来我更改了它,现在我也提交了一些其他内容。我也这样做了,以便用户可以选择他要提交的“服务”的数量。
现在表单仅在存在exactley 1“服务”时提交。 我认为问题在于“表单篡改”保护。 由于我希望用户“篡改”表单,我该如何禁用此保护?
我的 beforeFilter 看起来像这样:
parent::beforeFilter();
$this->Auth->allow('register_new');
// Security component
if (isset($this->Security) &&
$this->RequestHandler->isAjax() &&
($this->action == 'statistics'))
{
// $this->Security->validatePost = false;
$this->Security->csrfCheck = false;
}
if (isset($this->Security) &&
$this->RequestHandler->isAjax() &&
($this->action == 'markPaid'))
{
$this->Security->validatePost = false;
$this->Security->csrfCheck = false;
}
有问题的“操作”(没有获取任何数据的操作)是“register_new”。
【问题讨论】:
标签: forms cakephp cakephp-2.0