[英]Symfony2: handleRequest() is not submitting the form
我在Symfony 2.3.5中遇到了handleRequest方法的奇怪問題。
我正在使用handleRequest($ editForm-> handleRequest($ request))提交表單,並且一切正常。 但是在生產環境中它不起作用。 我已經調試了所有內容,但我發現它沒有提交此表單。
我已經成功地改變了這一點
$editForm->handleRequest($request)
至
$editForm->submit($request->request->get($editForm->getName()))
但有人可以告訴我為什么handleRequest在prod環境中對我不起作用?
我刪除了所有緩存。
編輯:我還提醒自己,它在創建方面做得很好,但在編輯/更新方面卻沒有。
你在創建$ editForm時設置方法參數嗎?
$editForm = $this->createForm(new TaskType(), $task, array(
'action' => $this->generateUrl('edit_task'),
'method' => 'PUT',
));
$editForm->handleRequest($request);
此外,您可能需要在配置中設置http_method_override
。 http://symfony.com/doc/current/reference/configuration/framework.html#http-method-override
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.