Yii2 widget for handle multiple inputs for an attribute of model and tabular input for batch of models.
The latest stable version of the extension is v2.27.0 Follow the instruction for upgrading from previous versions
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.
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);
?>
You can find a full version of documentation here
yii2-multiple-input is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.
id
from the settings if it is specifiedclear
was called\Traversable
in model attribute for yield
compatibility (bscheshirwork)\Traversable
in TableRenderer and ListRenderer for yield
compatibility (bscheshirwork)jsPositions
property for the BaseRenderer
to set right order js-code in jsInit
and jsTemplates
(Spell6inder)columnOptions
property in the BaseColumn
for TableRenderer and ListRenderer to support HTML options of individual column (InsaneSkull)theme
to disable all bootstrap css classesshowGeneralError
to enable displaying of general error messageiconMap
and iconSource
property for MultipleInput and TabularInputBaseColumn->renderDragColumn(), TableRenderer->renderCellContent(), BaseRenderer->prepareButtons()
afterDropRow
layoutConfig
property for the ListRenderer (antkaz)min
property to 0) for TabularInputenableError
afterAddRow
eventnameSuffix
to avoid errors related to duplication of id in case when you use several copies of the widget on a pageSortting
(sankam-nikolya)ListRenderer
MultipleInput
is used for active fieldlimit
option to max
unclead\widgets
to yii\multipleinput
addButtonPosition
when rendering the button (unclead)::className
instead of ::class
add
button in the footer (unclead)add
button at several positions (unclead)$enableError
not render element in template (thiagotalma)limit
(ivansal)options
(veksa)min
is equal to limit
rowOptions
propertyequal
to min
$(document)
min
for setting minimum number of rowsaddButtonPosition
beforeDeleteRow
eventallowEmptyList
(unclead)enableGuessTitle
for MultipleInput (unclead)items
attribute (unclead, stepancher)TabularInput
widget (unclead), rendering logic has been moved to separate class (renderer)first stable release
Comments