dev-master
9999999-deva complete drag and drop form builder
MIT
The Requires
by Masih Fathi
extension yii2 drag and drop form builder
a complete drag and drop form builder
Generate forms, surveys, polls, questionnaires (class FormBuilder), (*1)
Form render widget (class Form), (*2)
Storage data submitted from form in databases, (*3)
User Forms Demo: , (*4)
Added Feature: * Edit, Delete, Preview of submitted item data * Search and filter submitted item data * After submit event for forms data to use form for payments or ..., (*5)
Submitted Data Demo:, (*6)
, (*7)
Bug Fixed * Fix view bugs, (*8)
To do * add module to manage payment methods e.g. paypal, local payments and add payments button as optional drag and drop field to the form builder, (*9)
composer require masihfathi/yii2-drag-drop-forms "dev-master"
Make sure that you have properly configured db
application component in config file and run the following command:, (*10)
$ php yii migrate/up --migrationPath=@vendor/masihfathi/yii2-drag-drop-forms/migrations
Add the following code in your configuration file:, (*11)
'modules' => [ 'forms' => [ 'class' => '\masihfathi\form\Module', ], // Module Kartik-v Grid 'gridview' => [ 'class' => '\kartik\grid\Module' ], ]
URLs for the translating tool:, (*12)
/forms/module/index // List of all forms /forms/module/user // List of user forms /forms/module/view // Preview form /forms/module/create // FormBuilder - create form /forms/module/update // Update form /forms/module/delete // Delete form
'modules' => [ 'forms' => [ 'class' => 'masihfathi\form\Module', 'db' => 'db', 'formsTable' => '{{%forms}}', 'formDataTable' => 'form_', // dont use prefix please 'sendEmail' => true, 'emailSender' => 'info@email.net', 'rules' => [ [ 'actions' => [ 'update', 'delete', 'clone','deletemultiple','preview','update-item'], 'allow' => true, 'roles' => ['updateOwnForm'], // rule only owner can edit form ], [ 'actions' => ['user', 'create'], 'allow' => true, 'roles' => ['user'], // role only authenticated user can ] ], 'controllerMap' => [ 'module' => [ 'class' => '\masihfathi\form\controllers\ModuleController', 'on afterSubmit'=>function($event){ // code } ] ] ] ],
use masihfathi\form\Form; echo Form::widget([ 'body' => '[[{"field": "input", "type": "text", "width": "col-md-5", "name": "email", "placeholder": "email"},{"field": "input", "name": "pass", "type": "text", "placeholder": "pass", "width": "col-md-5"},{"field": "submit", "width": "col-md-2", "backgroundcolor": "btn-info", "label": "Submit"}]]', 'typeRender' => 'php' ]);
or, (*13)
echo Form::widget([ 'formId' => 1, // equivalennt 'form' => FormModel::findOne(1)->body ]);
Before you can go on you need to create those tables in the database., (*14)
php yii migrate --migrationPath=@yii/rbac/migrations
Building autorization data, (*15)
To use generator console, add fallowing code to config console file, (*16)
'controllerMap' => [ 'formsrbac' => [ 'class' => 'masihfathi\form\migrations\RbacController', ], ],
Create rbac tables in the database, (*17)
php yii migrate --migrationPath=@yii/rbac/migrations
Create rules and roles for form module, (*18)
php yii formsrbac/generate
For tests run, (*19)
composer exec -v -- codecept -c vendor/masihfathi/yii2-drag-drop-forms run
or, (*20)
cd vendor/masihfathi/yii2-drag-drop-forms codecept run
"require": { "php": ">=7.0.0", "yiisoft/yii2": "~2.0.0", "kartik-v/yii2-detail-view": "*", "kartik-v/yii2-grid": "*" }
Font Awesome must be available., (*21)
a complete drag and drop form builder
MIT
extension yii2 drag and drop form builder