PHP Classes

Yii2 Form PreFiller: Fill form inputs with the values entered by a user

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 21 All time: 11,324 This week: 660Up
Version License PHP version Categories
yii2-form-prefiller 1.0MIT/X Consortium ...5PHP 5, User Management
Description 

Author

This package can fill form inputs with the values entered by a user.

It provides a component for applications that use the Yii framework to store input values for each application.

The next time the user fills the form with the same inputs, this package can retrieve the values that the user entered so the application can supply the information with the last importance.

Innovation Award
PHP Programming Innovation award nominee
October 2022
Number 7
Many Web site users do not have much patience to do repetitive tasks.

If they have to fill out lengthy forms with information, they may avoid it and not fill it, especially if the form asks for values already requested.

This package provides some help to minimize that issue. It provides a solution to "remember" the values that a user filled in a form with the same types of inputs.

So next time a Web site asks the user to fill a form with the same fields, this package can provide the values the user entered last time so that the application can pre-fill the inputs with those values.

Manuel Lemos
Picture of Insolita
  Performance   Level  
Innovation award
Innovation award
Nominee: 18x

 

Documentation

Form assistant

Remember user-filled form data, prefill forms with remembered data Usefully for remember filter/sorting preferences, or make some sticky attributes

Status

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist insolita/yii2-form-prefiller "~1.0"

or add

"insolita/yii2-form-prefiller": "~0.0.1"

to the require section of your composer.json file.

Usage

Once the extension is installed, configure component :

'components'=>[
    'prefiller' => [
            'class'   => \insolita\prefiller\FormPrefiller::class,
            'storage' => [
            //one of storage types - db,session,cookie,redis supported
                'class'    => \insolita\prefiller\storages\CookieStorage::class,
            ],
        ],
]

Support ActiveRecord models,yii\base\Model,DummyModel

Remember $model data in storage

   Yii::$app->prefiller->persist($model, new PrefillConfig([]));

Fill $model from storage

  Yii::$app->prefiller->fillFromStorage($model, new PrefillConfig([
       'skipFromStorageAttributes'=>['someAttr'],
       'validateStorage'=>false
  ]));

Fill model from request->fillFromStorage->fillDefaults->persist if request update model

  $filter = new DummyModel(['page','sort','sortOrder','searchQuery','viewMode']);

  Yii::$app->prefiller->fill($filter, new PrefillConfig([
       'method'=>'get',
       'defaults'=>['sort'=>'price','sortOrder'=>'desc','viewMode'=>'grid']
       'skipFromRequestAttributes'=>['searchQuery'],
       'validateRequest'=>true
  ]));


  Files folder image Files (27)  
File Role Description
Files folder imagesrc (3 files, 2 directories)
Files folder imagetests (4 files, 2 directories)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file codeception.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:21
This week:0
All time:11,324
This week:660Up