Download the PHP package safan-form/form-manager without Composer
On this page you can find all versions of the php package safan-form/form-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download safan-form/form-manager
More information about safan-form/form-manager
Files in safan-form/form-manager
Package form-manager
Short Description Form Manager
License MIT
Homepage http://www.safanlab.com
Informations about the package form-manager
Form Manager
Form Manager for managing and building forms in Safan Framework.
REQUIREMENTS
PHP > 5.4.0
INSTALLATION
If you're using Composer for your project's dependencies, add the following to your "composer.json":
Update Modules Config List - safan-framework-standard/application/Settings/modules.config.php
Add Configuration - safan-framework-standard/application/Settings/main.config.php
USAGES
The FormManager initialized in Safan Handler by name 'formManager' , to use this class , call e.g.
To declare the type of form , you can use...
To use FormManager first you need to declare a Class in namespace 'Form' in your Module which wil extend FormType Class this is the class which contain form credentials. FormType is default class which namespace is FormManager/Type/FormType. e.g.
Your FormType Class have to declare two abstract methods --- 'buildForm()' and 'getName()'. first method - 'buildForm()' has dependency of FormBuilder $builder which builds forms fields . second method - 'getName()' returns the name of form which you can get in Form Class.
For any type of vield you can declare 'validation' which will be validated in initialization in FormValidation Class. Now are supported 'min', 'max' and 'callback' validations , but you can add your custom types extending Vaidation Class and declaring your custom methods in that Class.
'callback' must return boolean type. There ara default 'messages' for types 'min' and 'max', but you can declare custom messages adding 'message' type in 'validation' array.
VIEW
To build form in view you can use ... (e.g. in example we use bootstrap classes to build form in bootstrap view, but you can use your native classes or another framework for frontend view)
Every field is declared using this field's name which you declare in buildForm method of your Form Class.
The errors part is working if you verify the data after submitting form in your controller. e.g. to verify form
If there are errors the error messages will be shown on bottom of every field for which you have declared validations.