Skip to content

mhunesi/yii2-formio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii Formio Module


The package bundle of Form.io plugin. Form.io is a plain JavaScript form renderer.

JavaScript powered Forms with JSON Form Builder https://formio.github.io/formio.js

Examples

Installation

Add the the package to your composer file:

composer require mhunesi/yii2-formio

The last thing you need to do is updating your database schema by applying the migrations. Make sure that you have properly configured db application component and run the following command:

    yii migrate --migrationPath=@mhunesi/formio/migrations

Add the modules to your application configuration file:

'modules' => [
    // ...
    'formio' => [
        'class' => \mhunesi\formio\Module::class,
        'userModel' => 'app/models/User'
    ],
    // ...
]

Usage

If you want Using Only Formio Widget:

<?= FormioWidget::widget([
    'id' => 'example',
    'action' => Url::to(['example/create']),
    'thanksPage' => Url::to(['example/create']),
    'submission' => [
        'firstName' => 'Mustafa'
    ],
    'query' => [
        'components' => [
            [
                'type' => 'textfield',
                'key' => 'firstName',
                'label' => 'First Name',
                'placeholder' => 'Enter your first name.',
                'input' => true,
                'tooltip' => 'Enter your <strong>First Name</strong>',
                'description' => 'Enter your <strong>First Name</strong>',
            ],
            [
                'type' => 'button',
                'action'  => 'submit',
                'label' => 'Submit',
                'theme' => 'primary'
            ]
        ]
    ],
    'clientOptions' => [
        'hooks' => [
            'beforeSubmit' => new JsExpression("
                (submission, next) => {
                    if(confirm('Are you sure?')){
                        next();
                    }
                }"
            )
        ]
    ]

]) ?>

Or you can use Form.io Builder and:

$form = Forms::findOne(8);

$form->render([
    'thanksPage' => Url::to(['example/thanks']),
]);

Screenshots

screen-1

All Screenshots...


Built by mhunesi

About

Yii2 Formio Module. Formio is JavaScript powered Forms with JSON Form Builder

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages