我正在尝试使用Symfony2文档从一个页面(管理员页面)路由到另一个页面(ListQuestions),仍然无法使用提交按钮进行...
管理员控制器:
public function newAction(Request $request)
{
$entity = new Admin();
$form = $this->createCreateForm($entity);
$request = $this->getRequest();
if($request->getMethod()== 'POST')
{
$form->bindRequest($request);
if($form->isValid())
{
return $this->redirect($this->'PRIPRIBundle:ListQuestions:index.html.twig');
}
}
return $this->redirect('PRIPRIBundle:Admin:index.html.twig'.
array(
'entity' => $entity,
'form' => $form->createView(),
));
}
routing.yml:
_index:
pattern: index
defaults: { _controller: PRIPRIBundle:Admin:index }
index.html.twig:
name="input" action="" method="post">
<input type="submit" name="submit" value="Submit">
答案 0 :(得分:1)
您关注的文档是什么?这里有一堆错误。
我认为您应该仔细查看最新文档https://symfony.com/doc/current/book/forms.html(现在是v2.7)。