zakharov-andrew/yii2-survey-forms-widget

Yii2 Survey Form widget

v0.0.8 2022-11-17 12:30 UTC

This package is auto-updated.

Last update: 2024-04-17 15:38:20 UTC


README

Survey module for Yii2 application. Use SurveyForms.js javascript library

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require zakharov-andrew/yii2-survey-forms-widget

or add

"zakharov-andrew/yii2-survey-forms-widget": "*"

to the require section of your composer.json file.

Usage

use surveyforms\survey\Survey;

echo SurveyWidget::widget([
    'id' => 'survey-forms',
    'title' => 'First Survey Test',
    'description' => 'Simple description. SurveyForms.js demo',
    'background_color' => '#f7fafc',
    'question' => [
        (object)[
            'title' => 'Test Title 1',
            'required' => true,
            'options' => ['one', 'two', 'zero']
        ],
        (object)[
            'title' => 'Test Title 2',
            'required' => false,
            'options' => ['1', '2', '3'],
            'score' => 5
        ],
        (object)[
            'title' => 'Test Title 3',
            'type' => 'select',
            'required' => true,
            'options' => ['option 1', 'option 2', 'option 3'],
            'score' => 5
        ],
    ]
]);