ride / lib-form
Form library of the Ride framework
Installs: 5 685
Dependents: 21
Suggesters: 0
Security: 0
Stars: 0
Watchers: 8
Forks: 0
Open Issues: 0
Requires
- ride/lib-common: ^1.0.0
- ride/lib-image: ^1.0.0
- ride/lib-reflection: ^1.0.0
- ride/lib-system: ^1.0.0
- ride/lib-validation: ^1.0.0
- dev-master
- 1.2.0
- 1.1.0
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.14.11
- 0.14.10
- 0.14.9
- 0.14.8
- 0.14.7
- 0.14.5
- 0.14.4
- 0.14.3
- 0.14.2
- 0.14.1
- 0.14.0
- 0.13.0
- 0.12.13
- 0.12.12
- 0.12.11
- 0.12.10
- 0.12.9
- 0.12.8
- 0.12.7
- 0.12.6
- 0.12.5
- 0.12.4
- 0.12.3
- 0.12.2
- 0.12.1
- 0.12.0
- 0.11.1
- 0.11.0
- 0.10.0
- 0.9.8
- 0.9.7
- 0.9.6
- 0.9.5
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.8
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.2
- 0.1.1
- 0.1.0
- dev-develop
This package is auto-updated.
Last update: 2024-10-26 09:22:20 UTC
README
Form library of the PHP Ride framework.
What's In This Library
RowFactory
The RowFactory interface is used to create a Row based on a simple name. Using this factory adds flexibility to the forms since every row can be overwritten with another implementation if needed.
A default implementation is provided by the GenericRowFactory class.
Row
The Row interface is used to implement a row type. This can be a scalar type like a string, a number, ... all generic HTML form elements. It can also be a component or a collection of components.
The following rows are provided by this library:
- button
- collection
- component
- date
- file
- hidden
- image
- label
- number
- object
- option
- password
- select
- string
- text
- time
- website
- wysiwyg
Component
The Component interface is used to group a combination of rows into a single row or form. For example, a datetime component can combine a date row and a time row together into a single row. Creating components will add reusability to your forms.
Widget
The Widget interface is used to display a Row. Certain rows can have the same logic but a different view representation. Think about an option row which can be represented through a list of checkboxes (or radio buttons) or a select field.
View
The View interface is used to send the form to the UI. It removes everything needed to build the form and makes sure the form is serializeable.
Code Sample
Check this code sample to see some possibilities of this library:
<?php function createForm(Form $form) { // id of the form $form->setId('form-example'); // action to catch submission of different forms on one page $form->setAction('submit-example'); $form->addRow('name', 'string', array( 'label' => 'Name', 'description' => 'Enter your name', 'filters' => array( 'trim' => array(), ), 'validators' => array( 'required' => array(), ), )); $form->addRow('gender', 'option', array( 'label' => 'Gender', 'description' => 'Select your gender', 'default' => 'F', 'options' => array( 'F' => 'Female', 'M' => 'Male', 'O' => 'Other', ), 'validators' => array( 'required' => array(), ), )); $form->addRow('extra', 'string', array( 'label' => 'Extra', 'description' => 'Extra row to show off some other options', 'multiple' => true, 'disabled' => false, 'readonly' => false, 'attributes' => array( 'data-extra' => 'An extra attribute for the HTML element', ), )); return $form->build(); }
Related Modules
- ride/app-form
- ride/lib-common
- ride/lib-image
- ride/lib-reflection
- ride/lib-system
- ride/lib-validation
- ride/web-form
- ride/web-form-taxonomy
- ride/web-form-wysiwyg-ckeditor
- ride/web-form-wysiwyg-tinymce
Installation
You can use Composer to install this library.
composer require ride/app-form