我使用 jquery 克隆了一些输入字段,但它们没有显示在 post 请求中。我在某处读到这是因为验证,并且未使用 FormHelper 创建的字段将从请求中删除。
我添加了
$this->Security->validatePost=false;
到之前的过滤器功能,但现在我收到这些错误消息。有人可以帮我:)吗?
编辑:图像到文本,这是不可读的=)
Notice (8): Indirect modification of overloaded property LabelsController::$Security has no effect [APPPluginContentConfiguratorControllerLabelsController.php, line 116]
Code Context
{
parent::beforeFilter();
$this->Security->validatePost=false;
LabelsController::beforeFilter() - APPPluginContentConfiguratorControllerLabelsController.php, line 116
call_user_func - [internal], line ??
CakeEventManager::dispatch() - CORECakeEventCakeEventManager.php, line 242
Controller::startupProcess() - CORECakeControllerController.php, line 674
Dispatcher::_invoke() - CORECakeRoutingDispatcher.php, line 187
Dispatcher::dispatch() - CORECakeRoutingDispatcher.php, line 165
[main] - APPwebrootindex.php, line 108
Warning (2): Creating default object from empty value [APPPluginContentConfiguratorControllerLabelsController.php, line 116]
Code Context
{
parent::beforeFilter();
$this->Security->validatePost=false;
LabelsController::beforeFilter() - APPPluginContentConfiguratorControllerLabelsController.php, line 116
call_user_func - [internal], line ??
CakeEventManager::dispatch() - CORECakeEventCakeEventManager.php, line 242
Controller::startupProcess() - CORECakeControllerController.php, line 674
Dispatcher::_invoke() - CORECakeRoutingDispatcher.php, line 187
Dispatcher::dispatch() - CORECakeRoutingDispatcher.php, line 165
[main] - APPwebrootindex.php, line 108
根据 ndm 的要求,之前筛选函数来自:标签控制器.php
public function beforeFilter()
{
parent::beforeFilter();
$this->Security->validatePost=false;
}
应用控制器.php
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('login');
// Check if the model isset.
if (empty($this->model)) {
throw new FatalErrorException('De huidige controller heeft geen model opgegeven.');
}
// Set the layout to 'ajax' when the request is ajax.
if ($this->request->is('ajax')) {
$this->layout = 'ajax';
$this->autoRender = false;
}
}
安全组件未添加到公共$components数组中。
class Controller extends AppController
{
public $components = array('Security');
}