https://github.com/mhunesi/yii2-formio
Yii2 Formio Module. Formio is JavaScript powered Forms with JSON Form Builder
https://github.com/mhunesi/yii2-formio
formio yii2 yii2-modules yii2-widgets
Last synced: 4 months ago
JSON representation
Yii2 Formio Module. Formio is JavaScript powered Forms with JSON Form Builder
- Host: GitHub
- URL: https://github.com/mhunesi/yii2-formio
- Owner: mhunesi
- License: mit
- Created: 2020-04-16T12:23:02.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-27T13:59:01.000Z (8 months ago)
- Last Synced: 2025-01-16T04:57:07.126Z (5 months ago)
- Topics: formio, yii2, yii2-modules, yii2-widgets
- Language: PHP
- Homepage: https://mhunesi.github.io/yii2-formio/
- Size: 1.25 MB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
Yii Formio Module
The package bundle of [Form.io](https://github.com/formio/formio.js) plugin. Form.io is a plain JavaScript form renderer.
JavaScript powered Forms with JSON Form Builder https://formio.github.io/formio.js
[Examples](https://formio.github.io/formio.js/app/examples/)## Installation
Add the the package to your composer file:
```sh
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:```sh
yii migrate --migrationPath=@mhunesi/formio/migrations
```Add the modules to your application configuration file:
```php
'modules' => [
// ...
'formio' => [
'class' => \mhunesi\formio\Module::class,
'userModel' => 'app/models/User'
],
// ...
]
```## Usage
If you want Using Only Formio Widget:
```php
= 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 First Name',
'description' => 'Enter your First Name',
],
[
'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:
```php
$form = Forms::findOne(8);$form->render([
'thanksPage' => Url::to(['example/thanks']),
]);
```Screenshots
-----------
[All Screenshots](docs/screenshot.md)...
---
Built by [mhunesi](https://www.mustafaunesi.com.tr)