如何使用 Zend 重现一种将 div 和按钮放入其中的表单 [英] How to reproduce one form into which are put a div and a button one using Zend
问题描述
请问是否可以使用 Zend\Form\Form 复制此表单?
<button type="submit" class="btn btn-primary">Ajouter</button><a href="../compte" style="margin-left:5px;">Retourner à la liste<;/a></表单>
因为我无法找到如何使用包含这些标签的 api 编写 div.按钮也一样.
提前致谢!
是的,这是可能的.最简单的方法是在您的视图中简单地包含额外的标记:
=$this->form()->openTag($this->form)?><div class="form-group"><?=$this->formRow($this->form->get('identifiant'))?>
<?=$this->formButton($this->form->get('etc...'))?><?=$this->form()->closeTag()?>
如果您希望帮助程序自动包含标记,这也是可能的,但您需要自己扩展 formRow
帮助程序以实现此目的(涉及更多).
PS:您基本上问了与前几天相同的问题.与这可能吗?"相比,在 StackOverflow 上展示您想要实现的目标和您尝试过的内容的问题更有可能得到很好的答复.像这样的问题.
Is it possible to reproduce this form using Zend\Form\Form, please ?
<form method="post" action="add">
<div class="form-group">
<label for="identifiant">Identifiant</label>
<input type="text" class="form-control" name="identifiant" id="identifiant" value="" placeholder="Entrez l'identifiant" />
</div>
<button type="submit" class="btn btn-primary">Ajouter</button><a href="../compte" style="margin-left:5px;">Retourner à la liste</a>
</form>
Because I wasn't able to find how to write a div using that api into which I include those tags. And the same thing to the button.
Thanks in advance!
Yes, it's possible. The easiest way is to simply include the additional markup in your view:
<?=$this->form()->openTag($this->form)?>
<div class="form-group">
<?=$this->formRow($this->form->get('identifiant'))?>
</div>
<?=$this->formButton($this->form->get('etc...'))?>
<?=$this->form()->closeTag()?>
If you want the helpers to include the markup automatically this is also possible, but you'd need to extend the formRow
helper yourself to get it to to this (quite a bit more involved).
PS: You've basically asked the same question as you did the other day. Questions where you show what you're trying to achieve and what you've tried are much more likely to get a good reply on StackOverflow than "is this possible?" questions like this one.
这篇关于如何使用 Zend 重现一种将 div 和按钮放入其中的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!