shadowprince/forman
Composer 安装命令:
composer require shadowprince/forman
包简介
Form component for shadowprince/slimext
关键字:
README 文档
README
Forman is library for working with forms.
in code
$form = new \Forman\Form( new \Forman\Field\Value("email"), new \Forman\Field\Text("text"), (new \Forman\Field\Checkbox("subscr"))->setValue(1) ); if ($data = $form->process($_POST)) { // send email } render_template("contact.html", array( "form" => $form->getRenderer("\Forman\Render\HTML\Renderer") ->setAction("/contact") ->GET(), ));
in template
{{ form.render|raw }}
or
{{ form.top|raw }}
That's my form
{{ form.elements|raw }}
{{ form.bottom|raw }}
or even
<form action="{{ form.getAction }}" method="POST"> {% for field in form.getFields %} {% if field.getCaption %} <label class="caption">{{ field.getCaption }}</label> {% endif %} <span class="field"> {{ field.renderTag|raw }} </span> {% if field.getHint %} <span class="hint"> {{ field.getHint }} </span> {% endif %} {% endfor %} </form>
Forman writed for slimext, but not attached to it, you can use it with any framework or without it. Additional parameters to process passed to form validators (you can provide orm object or application instance).
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2013-10-15