unclead/yii2-multiple-input Widget for handle multiple inputs for an attribute of Yii2 framework model

yii2multipleinputyii2arrayinputyii2multiplefieldyii2tabularinput

Yii2 Multiple input widget.

Yii2 widget for handle multiple inputs for an attribute of model and tabular input for batch of models.

Latest Stable VersionTotal DownloadsDaily DownloadsLatest Unstable VersionLicense

Latest release

The latest stable version of the extension is v2.9.0 Follow the instruction for upgrading from previous versions

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require  unclead/yii2-multiple-input "~2.0"

or add

"unclead/yii2-multiple-input": "~2.0"

to the require section of your composer.json file.

Basic usage

Single column example

For example you want to have an ability of entering several emails of user on profile page. In this case you can use yii2-multiple-input widget like in the following code

use unclead\multipleinput\MultipleInput;

...

<?php
    echo $form->field($model, 'emails')->widget(MultipleInput::className(), [
        'max'               => 6,
        'min'               => 2, // should be at least 2 rows
        'allowEmptyList'    => false,
        'enableGuessTitle'  => true,
        'addButtonPosition' => MultipleInput::POS_HEADER // show add button in the header
    ])
    ->label(false);
?>

Documentation

You can find a full version of documentation in wiki

License

yii2-multiple-input is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

Changelog

Yii2 multiple input change log

2.9.0

  • Pass the added row to afterAddRow event

2.8.2

  • Fixed conflict with jQuery UI sortable

2.8.1

  • Fixed client validation

2.8.0

  • 137: added option nameSuffix to avoid errors related to duplication of id in case when you use several copies of the widget on a page

2.7.1

  • Fixed assets

2.7.0

  • Fixed an incorrect behavior of widget in case of ajax loading (e.g. in modal window)

2.6.1

  • Fixed assets

2.6.0

  • PR#132: Implemented Sortting (sankam-nikolya)
  • PR#132: fixed if attribute is set and hasProperty return false (sankam-nikolya)

2.5.0

  • 127: fixed js actions

2.4.0

  • Implemented ListRenderer

2.3.1

  • Fixed ajax validation for embedded fields

2.3.0

  • 107: render a hidden input when MultipleInput is used for active field

  • 109: respect ID when using a widget's placeholder

2.2.0

  • 104: Fixed preparation of js attributes (Choate, unclead)

  • Fixed removal of row with index 0 via js api method (pvlg)

2.1.1

  • Enh: Passing a deleted row to the event

2.1.0

  • Enh #37: Support of client validation

2.0.1

  • Bug #105: Change vendor name in namespace from yii to unclead to respect Yii recommendations

2.0.0

  • Renamed limit option to max
  • Changed namespace from unclead\widgets to yii\multipleinput
  • 92: Adjustments for correct work with AR relations

  • Enh #104: Added method to set value of an particular option

1.4.1

  • 99: Respect "defaultValue" if it is set and current value is empty (unclead)

1.4.0

  • 94: added ability to set custom renderer (unclead, bokodi-dev)

  • 97: Respect addButtonPosition when rendering the button (unclead)

1.3.1

  • Bug: Use method ::className instead of ::class

1.3.0

  • 79 Added support for embedded MultipleInput widget (unclead, execut)

  • Enh: Added ability to render add button in the footer (unclead)
  • Enh: Improving for better work without ActiveForm (unclead)
  • Enh: Added ability to render add button at several positions (unclead)

1.2.19

  • 85: fixed $enableError not render element in template (thiagotalma)

1.2.18

  • 81 fixed output of errors in case of non-ajax validation

1.2.17

  • Enh: increased default value for the property limit (ivansal)
  • Enh: Added support of associative array in data (ivansal)
  • Bug: fixed double execution events for included MultipleInput (fiamma06)

1.2.16

  • Bug #70: replacing of the placeholder after preparing the content of row

1.2.15

  • Added note about usage widget with ajax

1.2.14

  • Bug #71: trigger the event after actual removal of row

1.2.13

  • Added new js events (add/remove/clear inputs) and integrated the gulp for minification of assets (veksa)
  • Added support of closure for parameter options (veksa)

1.2.12

  • Hotfix: Fixed error when array_key_exits (kongoon)

1.2.11

  • Bug #61: Fixed a rendering of remove button
  • Bug #62: Incorrect behavior is case when min is equal to limit
  • Bug #64: Radio/checkbox lists doesn't work correctly

1.2.10

  • Enh #59 Added columnClass property (unclead)

1.2.9

  • Enh #56: add rowOptions property

1.2.8

  • Enh: Don't show action column when limit is equal to min

1.2.7

  • Bug #55: Attach click events to the widget wrapper instead of $(document)

1.2.6

  • Bug #49: urlencoded field token replacement in js template (rolmonk)
  • Enh #48: Added option min for setting minimum number of rows
  • Enh: added option addButtonPosition

1.2.5

  • Bug #46: Renamed placeholder to avoid conflict with other plugins
  • Bug #47: Use Html helper for rendering buttons instead of Button widget
  • Enh: Deleted yii2-bootstrap dependency

1.2.4

  • Bug #39: TabularInput: now new row does't copy values from the most recent row
  • Enh #40: Pass the current row for removal when calling beforeDeleteRow event

1.2.3

  • Enh #34: Added option allowEmptyList (unclead)
  • Enh #35: Added option enableGuessTitle for MultipleInput (unclead)
  • Bug #36: Use PCRE_MULTILINE modifier in regex

1.2.2

  • Enh #31: Added support of anonymous function for items attribute (unclead, stepancher)
  • Enh: added hidden field for radio and checkbox inputs (unclead, kotchuprik)
  • Enh: improved css (fiamma06)

1.2.1

  • Bug #25 fixed rendering when data is empty
  • Bug #27 fixed element's prefix generation

1.2.0

  • Bug #19 Refactoring rendering of inputs (unclead)
  • Bug #20 Added hasAttribute checking for AR models (unclead)
  • Enh #22 Added TabularInput widget (unclead), rendering logic has been moved to separate class (renderer)

1.1.0

  • Bug #17: display inline errors (unclead, mikbox74)
  • Enh #11: Improve js events (unclead)
  • Bug #16: correct use of defaultValue property (unclead)
  • code improvements (unclead)

1.0.4

  • Bug #15: Fix setting current values of dropDownList (unclead)
  • Bug #16: fix render of dropDown and similar inputs (unclead)
  • Enh: Add attributeOptions property

1.0.3

  • Bug: Hidden fields no longer break markup (unclead, kotchuprik)

1.0.2

  • Enh: added minified version of js script (unclead)
  • Enh #8: renamed placeholders for avoid conflicts with other widgets (unclead)
  • Enh #7: customization of header cell

1.0.1

  • Enh #1: Implemented ability to use widget as column type (unclead)
  • Enh: add js events (ZAYEC77)

1.0.0

first stable release

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



2.9.0 is the latest of 48 releases



BSD-3-Clause license
Stats
140 github stars & 50 github forks
1 downloads in the last day
3381 downloads in the last 30 days
34073 total downloads