PHP code example of mhunesi / yii2-formio
1. Go to this page and download the library: Download mhunesi/yii2-formio library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mhunesi / yii2-formio example snippets
'modules' => [
// ...
'formio' => [
'class' => \mhunesi\formio\Module::class,
'userModel' => 'app/models/User'
],
// ...
]
<?= 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();
}
}"
)
]
]
])
$form = Forms::findOne(8);
$form->render([
'thanksPage' => Url::to(['example/thanks']),
]);