2017-25 © Pedro Peláez
 

library paris-form-helper

Form helper for Paris ORM inspired by ActiveView::Helpers::FormHelper

image

nicolas-brousse/paris-form-helper

Form helper for Paris ORM inspired by ActiveView::Helpers::FormHelper

  • Monday, November 17, 2014
  • by nicolas-brousse
  • Repository
  • 2 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Paris Form Helper

Form helper for Paris ORM and inspired by ActiveView::Helpers::FormHelper.
It can be use without Paris., (*1)

Example

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')) ?>


How use it?

Start the form

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)

Label

$form->label(string $name [ string $label, [, array $attributes [, array $options ]]]), (*5)

Inputs

List of inputs: checkbox - email - hidden - password - text, (*6)

Hidden

Text

$form->text_field(string $name [, array $attributes [, array $options ]]), (*7)

Email

$form->email_field(string $name [, array $attributes [, array $options ]]), (*8)

Password

$form->password_field(string $name [, array $attributes [, array $options ]]), (*9)

Checkbox

$form->checkbox(string $name [, array $attributes [, array $options ]]), (*10)

TextArea

$form->textarea(string $name [, array $attributes [, array $options ]]), (*11)

Submit

$form->submit(string $label [, array $attributes ]), (*12)

The Versions

17/11 2014

dev-master

9999999-dev https://github.com/nicolas-brousse/paris-form-helper

Form helper for Paris ORM inspired by ActiveView::Helpers::FormHelper

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

form helper paris active view