ahmadasjad/yii2-widgets

An extension for input with facility to increase and decrease the value with the button

Installs: 192

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2020-04-21 13:35 UTC

This package is auto-updated.

Last update: 2024-12-22 00:19:24 UTC


README

Plus-Minus-Input

Installation
composer require ahmadasjad/yii2-widgets
Usage Example
<?php
echo \ahmadasjad\yii2Widgets\PlusMinusInput::widget([
    'name' => 'name_test',
    'plugin_options' => ['parser'=>'parseFloat', 'step'=>0.5]
]);
?>

Options to customize the plugin in plugin_options param:

[
    'val_min' => 0,
    'val_max' => 1000,
    'step' => 1,
    'parser' => 'parseInt',
    'container' => ['class' => 'input-group', 'id' => 'your-custom-id-container'],
    'plus' => ['id' => 'your-custom-id-plus', 'class' => 'btn btn-success', 'label' => '+',],
    'minus' => ['id' => 'your-custom-id-minus', 'class' => 'btn btn-danger', 'label' => '-',],
]

val_min Minimum value allowed for input

val_max Maximum value allowed for input

step How much value to be increased/decreased on press of plus/minus button

parser Javascript function to parse the input data. For example parseInt, parseFloat, etc.

plus configuration for plus button minus configuration for plus button