kartik-v/yii2-field-range Easily manage Yii 2 ActiveField ranges (from/to) with Bootstrap 3 addons markup and more

extensionwidgetbootstrapdaterangefield-rangefromtoaddonbootstrap3bootstrap4

Krajee Logo
yii2-field-range Donate

Stable Version Unstable Version License Total Downloads Monthly Downloads Daily Downloads

A Yii 2 extension that allows you to easily setup ActiveField range fields with Bootstrap 3 addons markup and more. This allows you to setup the attributes joined together like a single field with a bootstrap addon separating the two. In addition, it enables you to display the field validation error messages as one single block instead of separate validation errors for two fields.

NOTE:

  • The FieldRange validation routine displays only the first error encountered in validation of either of the attributes.
  • To understand setting up your model validation rules for the attributes when using this extension, refer this wiki

The key features supported by this widget extension are:

  • display the two range fields as a single grouped block using Bootstrap 3 addons
  • tweak yii active form validation to display validation errors as one single block instead of separate error blocks under each field. This allows you to style your field range inputs better for various form layouts. No more misalignment of adjacent fields due to yii validation error messages.
  • ability to use any input from yii\helpers or any widget class for rendering the from and to fields.
  • enhanced usage with \kartik\widgets\ActiveField that allows you to add custom addons to prepend and append to your inputs.
  • default support for all widgets under \kartik\widgets. Special enhanced support for \kartik\widgets\DatePicker to render date ranges.
  • ability to use the kartik\datecontrol\DateControl widget which in turn can use any Date or Time widgets.

Demo

You can see detailed documentation and demos on usage of the extension.

Release Changes

NOTE: Refer the CHANGE LOG for details on changes to various releases.

Installation

The preferred way to install this extension is through composer.

Note: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

Either run

$ php composer.phar require kartik-v/yii2-field-range "dev-master"

or add

"kartik-v/yii2-field-range": "dev-master"

to the require section of your composer.json file.

Usage

FieldRange

use kartik\field\FieldRange;
use kartik\widgets\ActiveForm;
$form = ActiveForm::begin();
echo FieldRange::widget([
    'form' => $form,
    'model' => $model,
    'label' => 'Enter start and end points',
    'attribute1' => 'start_point',
    'attribute2' => 'end_point',
    'type' => FieldRange::INPUT_TEXT,
]);
ActiveForm::end();

License

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

Changelog

Change Log: yii2-field-range

Version 1.3.5

Date: 25-May-2019

  • Implement stale bot.

Version 1.3.5

Date: 09-Oct-2018

  • Update composer dependencies
  • (enh #28): Styling enhancements for BS addons.

Version 1.3.3

Date: 25-Aug-2018

  • Updates to support Bootstrap 4.x.
  • Reorganize all source code to src directory.

Version 1.3.2

Date: 06-Sep-2017

  • Cleanup composer.json.
  • (enh #24): Add new property addInputCss to override default form-control style.
  • (enh #22): Enhance separator config for both form and non-inputs.
  • (enh #21): Add composer dependencies for yii2-helpers and `yii2-widgets-activeform.

Version 1.3.1

Date: 03-Sep-2016

  • (enh #18): Enhancements to code and PHP documentation
    • Enhance the field range plugin code.
    • Enhance PHP Documentation for all classes and methods in the extension.
  • (enh #8): Styling enhancements for bootstrap horizontal form layout
  • JS Lint changes and code cleanup.
  • Set copyright year to current.
  • Add contribution and issue/PR log templates.

Version 1.3.0

Date: 25-Nov-2014

  • (enh #7): Enhance widget to use updated plugin registration from Krajee base

Version 1.2.0

Date: 15-Nov-2014

  • (enh #6): Validate right dependency with kartik\form\ActiveForm.
  • Set dependency on Krajee base components
  • Set release to stable

Version 1.1.0

Date: 16-Sep-2014

  • (enh #3): Upgrade field range jQuery plugin to work better with yii active form validation
  • PSR4 alias change

Version 1.0.0

Date: 14-Jul-2014

  • Initial release

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



v1.3.5 is the latest of 9 releases



BSD-3-Clause license
Stats
24 github stars & 9 github forks
882 downloads in the last day
19941 downloads in the last 30 days
1453950 total downloads