Symfony2形式锚 [英] Symfony2 Form Anchors
本文介绍了Symfony2形式锚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一页上的不同标签下有许多表格
I have a number of forms on the one page under different tabs
在处理完表单后,我想返回到发送表单的相同标签.
After the form is processed, I would like to return to the same tab as the form was sent from.
基本上,我想修改target_route以转到URL末尾带有锚点的当前页面. (例如,EG company/view/6#editdetails)
Basically, I would like to modify the target_route to go to the current page with an Anchor at the end of the URL. (EG company/view/6#editdetails)
有人可以提供或链接到我可以放入控制器或树枝的示例吗?
Could someone provide or link to an example that I can put in my controller or into twig?
推荐答案
答案很简单:
$form = $this->createForm(new ContactType($contact), $contact, array(
'method' => 'POST',
'action' => '#editdetails'
));
这篇关于Symfony2形式锚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文