How to reproduce one form into which are put a div and a button one using Zend [closed]

亡梦爱人 提交于 2019-12-13 03:56:52

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/24731399/how-to-reproduce-one-form-into-which-are-put-a-div-and-a-button-one-using-zend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!