Giter Club home page Giter Club logo

yii2-formbuilder's Introduction

Yii2 Form Builder

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

Installation

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.

Usage

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

use meysampg\formbuilder\FormBuilder;

and use it as a widget:

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

Configurations

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

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

Examples

<?= 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',
]); ?>

formbuilder-fa

Translation

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

yii2-formbuilder's People

Contributors

macbenach avatar meysampg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.