我有一条路线。 摘录如下:
pattern: /admin/clients/{clientid}/projects/{projectid}/review/{id}/comments
defaults: { _controller: ShoutAdminBundle:Project:revcomm }
requirements:
_method: POST
现在,在一页(评论页)上,我有一份表格,用户将提出意见,然后提交该网页。 然后,用户点击提交,将回首页,但其评论将提交给数据库,然后展示。
My Form code looks like this:
<form action="{{ path( ShoutAdminBundle_adminprojectreviewcommentssuccess ) }}" method="post" {{ form_enctype(form) }} class="blogger">
{{ form_errors(form) }}
<p class="comments">
{{ form_label(form.from, Your Name* , { attr : { class : title } }) }}
{{ form_errors(form.from) }}
{{ form_widget(form.from, { attr : { class : textfield }}) }}
</p>
<p class="comments">
{{ form_label(form.comment, Your Comment* , { attr : { class : title } }) }}
{{ form_errors(form.comment) }}
{{ form_widget(form.comment, { attr : { class : textfield }}) }}
</p>
<p class="comments_save">
<input type="submit" value="Post Your Comment" id="savebutton" class="savebutton" />
</p>
{{ form_rest(form) }}
</form>
现在。 当该网页被贴上时,我有以下错误:
An exception has been thrown during the rendering of a template ("The "ShoutAdminBundle_route" route has some missing mandatory parameters ("id", "projectid").") in "ShoutAdminBundle:Default:projectreviewcomments.html.twig" at line 54.
我如何将各种变量({clientid}
,{projectid}
和{id}
上移至网页? 这些变量已在网页上公布,这提出了一个问题,即我如何在形式上列入这些变量?
Cheers