dev-master
9999999-dev https://github.com/nicolas-brousse/paris-form-helperForm helper for Paris ORM inspired by ActiveView::Helpers::FormHelper
MIT
The Requires
- php >=5.2.0
form helper paris active view
Wallogit.com
2017 © Pedro Peláez
Form helper for Paris ORM inspired by ActiveView::Helpers::FormHelper
Form helper for Paris ORM and inspired by ActiveView::Helpers::FormHelper.
It can be use without Paris., (*1)
A Paris Model, (*2)
create(); ?>
...
array('class' => 'form'))) ?>
= $form->label('title') ?><br />
= $form->text_field('title') ?>
= $form->label('content') ?><br />
= $form->text_area('content', array('cols' => 50, 'rows' => 4)) ?>
= $form->label('author') ?><br />
= $form->text_area('author', array('class' => 'author-input')) ?>
= $form->label('is_publish') ?><br />
= $form->text_area('is_publish', array('check_value' => 'yes', 'uncheck_value' => 'no')) ?>
To start the form use Helpers_Form::form_for($model, $form_action, array $options).
$model: the model to use for the form. So form values ares automaticaly setted. It can be null for standalone forms.
$form_action: url to send the datas.
$options: the options of the forms. The options are:
* method: to precise the form method (post|get). Note: if you use Paris Model method are auto-setted post if the model is new and put for edition.
* html: to add attributes on <form /> tag.
And it return the instance of the form. It necessary to access the form helper methods., (*3)
To close the form use Helpers_Form::end_form_for() for print it., (*4)
$form->label(string $name [ string $label, [, array $attributes [, array $options ]]]), (*5)
List of inputs: checkbox - email - hidden - password - text, (*6)
$form->text_field(string $name [, array $attributes [, array $options ]]), (*7)
$form->email_field(string $name [, array $attributes [, array $options ]]), (*8)
$form->password_field(string $name [, array $attributes [, array $options ]]), (*9)
$form->checkbox(string $name [, array $attributes [, array $options ]]), (*10)
$form->textarea(string $name [, array $attributes [, array $options ]]), (*11)
$form->submit(string $label [, array $attributes ]), (*12)
Form helper for Paris ORM inspired by ActiveView::Helpers::FormHelper
MIT
form helper paris active view