Giter Club home page Giter Club logo

buttflattery / yii2-formwizard Goto Github PK

View Code? Open in Web Editor NEW
96.0 96.0 13.0 454 KB

A Yii2 plugin used for creating stepped form or form wizard using yii\widgets\ActiveForm and \yii\db\ActiveRecord

Home Page: https://yii2plugins.omaraslam.com/formwizard

License: Other

PHP 61.33% CSS 22.31% JavaScript 16.36%
form-wizard javascript php plugin-smartwizard smartwizard tabular-steps wizard yii2-extension yii2-formwizard yii2-plugin yii2-plugins yii2-widget

yii2-formwizard's People

Contributors

buttflattery avatar sircovsw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-formwizard's Issues

Issue using kartik\widget\DepDrop in FormWizard

Using the Dependent dropdown widget by kartik acts strange as the dropdown always shows the default one without css even if i specify the "type"=>DepDrop::TYPE_SELECT2 in the DepDrop options. although it is working ok and populates the options on runtime if the parent dropdown changes

how to set hint?

Thank you for great extension, can u explain pls, how to set hint() for input group?

Multiple models attributes with similar names

I would like to utilize the multiple models feature, but my models has attributes with similar names ( model_one.name and model_two.name) , how can I reference them.
I tried hiding one of them by using the code below but it is not working.
'model_two.name' => false,

here is the full code:
[
'model' => [$model_one,$model_two],
'title' => 'Project Details',
'description' => 'Enter Project Details',
'formInfoText' => '',
'fieldConfig' => [
'created_at' => false,
'updated_at' => false,
'budget' => false,
'currency' => false,
'model_two.name' => false,
'name' => [
'widget' => Select2::classname(),
'options' => [
'data' => ArrayHelper::map(Partner::find()->all(), 'id', 'name'),
'language' => 'sw',
'options' => ['placeholder' => 'Select Partner...'],
'pluginOptions' => [
'allowClear' => true
],
]
],
],
],

Need help on FORM widget Yii2

I am using your plugin Yii2 form widget and its really cool but i want to implement more functionality on this widget like based on the selection of fields (select2) from 1st step then the other steps will be visible. Is it possible?

Add Row makes input widgets unresponsive

Javascript based input Widgets not working in tabular steps after adding a new row. like, for example, select2, datepicker does not open the dropdown when clicked.

How can set bootstrap version ?

Hi, thanks for this amazing extension,
I load bootstrap 3.0 from composer.json but this widget add a bootstrap.css file that corrupts my css.

I can't personalize my fields

Hi, I am using the buttflattery \ formwizard \ FormWizard plugin to design my form and I notice that the fields that I customize are not displayed. Here is my code :

<?= FormWizard::widget([ 'formOptions' => [ 'id' => 'my_form_ajax', 'enableClientValidation' => true, 'enableAjaxValidation' => false, ], 'theme' => FormWizard::THEME_DOTS, 'enablePreview' => true, 'classListGroup' => 'list-group', 'classListGroupHeading' => 'list-group-heading', 'classListGroupItem' => 'list-group-item-info', 'classListGroupBadge' => 'danger', 'steps' => [ // [ 'model' => $model, 'title' => 'Identité', 'description' => 'identité du membre', 'formInfoText' => 'Renseignez l\'identité du membre', 'fieldConfig' => [ 'only' => [ 'BASE_ID', 'MEMBRE_NOM', 'MEMBRE_PRENOM', 'MEMBRE_SEXE' => [ 'options' => [ 'type' => 'dropdown', 'itemsList' => ['M' => 'Masculin', 'F' => 'Féminin'], 'prompt' => 'Sélectionnez le sexe', ], ], 'MEMBRE_DATE_DE_NAISSANCE' => [ 'widget' => DatePicker::class, 'options' => [ 'language' => 'es', 'readonly' => true, 'pluginOptions' => [ 'autoclose' => true, 'format' => 'dd/mm/yyyy', 'todayHighlight' => true, ] ] ], 'MEMBRE_LIEU_DE_NAISSANCE', 'MEMBRE_PROFESSION', 'MEMBRE_CONTACT', ], // only these field will be added in the step, rest all will be hidden/ignored. ] ], [ 'model' => $model, 'title' => 'Sacrements', 'description' => 'Sacrements reçus par le membre', 'formInfoText' => 'Renseignez les sacrements reçus par le membre', 'fieldConfig' => [ 'only' => [ 'MEMBRE_DATE_DE_BAPTEME', 'MEMBRE_LIEU_DE_BAPTEME', 'MEMBRE_DATE_DE_COMMUNION', 'MEMBRE_LIEU_DE_COMMUNION', 'MEMBRE_DATE_DE_CONFIRMATION', 'MEMBRE_LIEU_DE_CONFIRMATION', 'MEMBRE_DATE_DE_MARIAGE', 'MEMBRE_LIEU_DE_MARIAGE', ], // only these field will be added in the step, rest all will be hidden/ignored. ] ], [ 'model' => $model, 'title' => 'A propos du Sacré-Coeur', 'description' => 'Cérémonies reçus par le membre', 'formInfoText' => 'Renseignez les cérémonies reçus par le membre', 'fieldConfig' => [ 'only' => [ 'MEMBRE_DATE_INTRONISATION', 'MEMBRE_DATE_ADMISSION_SOLLENELLE', ], // only these field will be added in the step, rest all will be hidden/ignored. ] ], [ 'model' => $model, 'title' => 'Associations', 'description' => 'Autres associations', 'formInfoText' => 'Renseignez les autres associations dans lesquelles le membre est actif', 'fieldConfig' => [ 'only' => [ 'MEMBRE_ASSOCIATION1', 'MEMBRE_ROLE_ASSOCIATION1', 'MEMBRE_ASSOCIATION2', 'MEMBRE_ROLE_ASSOCIATION2', ], // only these field will be added in the step, rest all will be hidden/ignored. ] ], [ 'model' => $model, 'title' => 'Divers', 'description' => 'Autres informations', 'formInfoText' => 'Renseignez les autres informations', 'fieldConfig' => [ 'only' => [ 'MEMBRE_MOTIF_ADHESION', 'MEMBRE_OBJECTIFS_A_COURS_TERME', 'MEMBRE_OBJECTIFS_A_LONG_TERME', 'MEMBRE_ROLE_ASSOCIATION2', 'MEMBRE_DATE_ADHESION', 'MEMBRE_DUREE_ADHESION' ], // only these field will be added in the step, rest all will be hidden/ignored. ] ], ] ]); ?>

All the fields appear in my form except the 'MEMBRE_SEXE and 'MEMBRE_DATE_DE_NAISSANCE fields that I tried to customize. Can you help me please? Thank you in advance.

Repeat Steps

Hi
I'm trying to make a step repeat several times and I can not find a way to do it in this repository ...
Could you tell me if there is a possibility that it could be done through an option for example repeat step (boolean) and in the sumit would pass to the model an array of that model... I'ts just an idea...

thanks...

Input type file not working

When I try create a Form Wizard using custom field options and I setting a input type "file" the widget not create the input correctly.

In my view I have the follow code:

...
<?php
    echo FormWizard::widget([
        'steps'=>[
            [
                'model'=> $loadFile,
                'title'=>'Basic Information,
                'formInfoText'=> false,
                'fieldConfig' => [
                    'start' => [
                        'widget' => DatePicker::class,
                        'options' => [
                            'language' => 'es',
                            'readonly' => true,
                            'pluginOptions' => [
                                'autoclose'=> true,
                                'format' => 'dd/mm/yyyy',
                                'todayHighlight' => true,
                            ]
                        ]
                    'filename' => [
                        'type' => 'file',
                        'multifield' => true,
                    ],
               ]
           ],
        ]
    ]);
?>
...

But in the the browser side I have the follow HTML: <input type="text" id="loadfiles-filename" class="form-control" name="LoadFiles[filename][]">

Tabular step row remove icon

The tabular step's remove row icon is appearing in a normal step which uses multiple models. as array

 [
            'model' => [$user, $profile],
            'title' => 'User Account',
            'description' => 'Add Your Info',
            'formInfoText' => 'Add all fields'
        ]

"kartik/DepDrop" across "WizardSteps"

Hi

Basically I have a step where I select from a select2 an item and in the next step (STEP_TYPE_TABULAR) I need to load a dropdownlist, data from a relationship in the database.

table1: id, name(select2 on step1)
table2: id, name, id_table1(DepDrop as select2 on step2 where id_table1 comes from field on step1)

but I don't know how to access the value stored in the select2 of step1, to give it a parameter in step2.

plugins used: select2, preferably DepDrop; both of de kartik

I would greatly appreciate if you can help me solve my problem.

Jump to any step

Hello,

Is this possible to jump to any step from the FORM wizard, actually i want to activate all the steps when i am going to update my records? It is ok for the creation of the new record but it should be active all the steps when i update my records.

Can you please help me on this.

Thank you,
Girish

Default form action on update

The default ActiveForm action is overwitten in setDefaults()

$this->formOptions['action'] = ArrayHelper::getValue($this->formOptions, 'action', Url::to(['/' . Yii::$app->controller->id . '/' . Yii::$app->controller->action->id]));

This causes problems when the form is used to update an existing model, action should only be changed if it has been specified it in widget options.

Ability to group fields under a heading in a step.

Capable to insert a heading after a field inside the step at any desired position between fields The divider should be capable to add a heading along with the divider.

When we are using a step for combined inputs/models like we have user and profile models and we have assigned the user and profile section in a single step and we want the fields the be grouped with a different heading which acts as a divider, see the image below to have an idea.

image

Separator and custom label

In the preview step when a field has no value selected or filled, it’s show “NA”.

  • Is it possible to choose another text to display instead of “NA”?
  • For a tabular step, also, is it possible to insert a separator line between tabular models?

redirect finish button

when we klik at finish button show blank add form, can we redirect to index form not to blank add form
thanks alot for this on widget

Request: Visability flag

Can we please have a visibility variable in the field config?

isset($fieldConfig[$attribute]['visible'])&& $fieldConfig[$attribute]['visible'] == false

Upload multiple images with kartik-v file input extension

Hi, your extension works fine. I am so glad you saved me a lot of hustle when creating my app. However, I encountered a problem whereby I am unable to upload multiple images by making the form field accept an array; i.e. an image field with the field name of will have to be <image[]> so as to accept multiple uploads which does not work in this case. This is part of my code for the _form.php view:

[
    'model'=>$imageModel,
    'title'=>'Images',
    'description'=>'Give us the details of the list',
    'formInfoText'=>'Fill all required fields',
    'fieldConfig' => [
        'only' => ['image[]'],
        'image[]' => [
            'widget' => FileInput::classname(),
            'options' =>[
                'options' => [
                    'multiple' => true,
                    'accept' => 'image/*',
                    'pluginOptions' => [
                        'showCaption' => false,
                        'showRemove' => false,
                        'showUpload' => false,
                        'browseClass' => 'btn btn-primary btn-block',
                        'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ',
                        'browseLabel' =>  'Attach Listing Images',
                        'allowedFileExtensions' => ['jpg','gif','png'],
                        'overwriteInitial' => false
                    ],
                ],
            ],
        ]
    ]
],

Kindly assist where possible;

Custom items in single Wizard-step

Hi

I would like to know if it is possible to add custom items to a specific Step.

for example:

  1. step1: car_model: with basic information about the car.

  2. step2:

  • type => tabular

  • model => car_brands_model: with select2 for select brand.

No Tabular items:

  • If the brand does not exist, there is a button to open a modal with Form in popup to add the brand.
  • A button to keep the information incomplete and complete it later.
  1. step3: car_owner_model.

  2. step4

  • Detailview with summary informacion. Save or delete data

Summary: Step2 has custom elements that I would like to know how you can add

Tknx

How to include the softark\duallistbox\DualListbox widget in formwizard Step

Hello, I really liked your wrapper of smart wizard, however, I can't put object variables into 'options' when I use another widget inside of your one. I think it's important, cuz many other widgets require setting object variables into options array. Thanks beforehand.

[
    'model' => $hiringTeam,
    'title' => 'HIRING TEAM',
    'description' => 'Choose members of the selection committee',
    'formInfoText' => '',
    'fieldConfig' => [
        'only' => ['employee_ids'],
        'employee_ids' => [
            'widget' => \softark\duallistbox\DualListbox::className(),
            'options' => [
                'model' => $hiringTeam,
                'attribute' => $hiringTeam->employee_ids,
                'items' => $employees,
                'clientOptions' => [
                    'moveOnSelect' => true,
                    'selectedListLabel' => 'General Hiring Team',
                    'nonSelectedListLabel' => 'Hiring Team for this job',
                ],
            ],
        ],
    ],
],

Hidden fields

We could do with hidden fields on the form

 \buttflattery\formwizard\FormWizard ->createCustomizedField

'hidden' => function ($field, $options, $labelOptions, $label){
                return $field->hiddenInput($options)->label(false);
            }

Final Preview Feature

  • After adding all the steps there should be the last step which should preview all the inputs entered for the steps.
  • The user should be able to navigate to the step by clicking on the preview window.
  • this option should be turned off by default, and users will need to specify the enablePreview in the main options.

It should be something near like below
image

Enable Data Persistence for unsaved form

  • Add New option named enablePersistence.
  • When enabled the unsaved form data will be stored inside the local storage and if the page closes or navigates away the user would still be able to restore the data using the Restore button.
  • The local storage would be cleared as soon as you submit the form or click the finish button. In this case, you would still see the Restore button but it will be disabled.
  • persistenceEvents option should be added for the attributes, which takes the array of events where a user can bind the afterRestore event callback. The callback has 2 params e event and params a JSON which has {fieldId:'field_id',fieldValue:'restored value'}.This option is very similar to the tabularEvents, the only difference is that it would be applicable to any type of step field. the configuration should look like below.
'fieldConfig' => [
    'username' => [
        "persistenceEvents"=>[
              "afterRestore"=>"function(e,params){
               }"
         ]
    ]
 ]
  • The restore functionality should be able to restore the dynamically created rows for the Tabular steps and the values for their fields too.

How to get data from previous step?

Is it possible to know what the user was entered on first step to use it for some dependance on 2nd step? Maybe you can add something to fill model via ajax after clicking "next" and use this filled data to build next step.

Request: Field Order

The order of fields are hard to control as the order is taken from the model attributes. I suggest an extra option called 'order' this would be an integer order.

Form layout

Hi, after updating I noticed that there's a bug in the output of the form. Below is a screenshot of the problem.
bug

Tabular Input

Tabular data can not be collected from the backed(controller) using the way specified by Yii2 tabular data collection. to achieve this in yii2 I need to use "Model::loadMultiple" in my controller for that I need to declare my model as array and initialize it.then the beauty of fronted is lost (front end is not dynamic).and if I pass a array with single object I can catch only one object from controller. how can I solve this.can you share your sample controller which relevant to given example in tabular form

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.