formbuilder A drag and drop form builder with jQuery for Yii2

Yii2 Form Builder

  1. Installation
  2. Usage
  3. Configurations
  4. Examples
  5. Translation

A drag and drop form builder with jQuery for Yii2 which built upon to jQuery FormBuilder plugin.


The preferred way to install this extension is through composer.

Either run

composer.phar require meysampg/yii2-formbuilder "*"

or add

"meysampg/yii2-formbuilder": "*"

to the require section of your composer.json file.


Once the extension is installed, simply use it in your code by:

use meysampg\formbuilder\FormBuilder;

and use it as a widget:

<?= FormBuilder::widget(); ?>


There are some properties that let you to easily control over form builder.

Property Type Description Default Value
accessVariableNamestringJavaScript variable name for accessing to formbuilder contents in JS codes 'formBuilderJsVariable'
data array list of elements for rendering as default elements of form builder
dataTypestringindicates that input and output data must be XML or JSON'xml'
elementTypestring HTML tag for form builder constructor 'div'
messagesarray list of label strings on a desired language
languagestringDesired language for showing form builder (See translation section)
options array list of plugin options, see FormBuilder Documentations
showActionButtonsboolean indicates that control buttons be showed or not false


<?= FormBuilder::widget([
    'data' => [
            "type" => "header",
            "subtype" => "h1",
            "label" => "Header",
            "class" => "header",
            "type" => "button",
            "label" => "Button",
            "subtype" => "button",
            "class" => "button-input btn btn-warning",
            "name" => "button-1475845417456",
            "style" => "warning",
]); ?>

screen shot 2016-10-08 at 13 00 02

<?= FormBuilder::widget([
    'dataType' => 'json' 
]); ?>

screen shot 2016-10-08 at 13 04 32

<?= FormBuilder::widget([
    'messages' => [
        "autocomplete" => "Autocomplete 23",
]); ?>

screen shot 2016-10-08 at 13 18 55

<?= FormBuilder::widget([
    'language' => 'fa-IR',
]); ?>



Simply copy en.php file in messages folder and rename it to your language (e.g. ar, 'fr', ...), translate strings, commit your changes and send a pull request.

2 0
Yii Version: 2.0
License: MIT
Category: User Interface
Developed by: meysampg
Created on: Nov 19, 2016
Last updated: 3 years ago

Related Extensions