2017 © Pedro Peláez
 

yii2-widget yii2-dependentinput

Yii 2 Dependent Form Input

image

smladeoye/yii2-dependentinput

Yii 2 Dependent Form Input

  • Sunday, June 18, 2017
  • by smladeoye
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

yii2-dependentinput

YII 2 Dependent Form-Input Control Widget, (*1)

  • [Installation] (https://github.com/smladeoye/yii2-dependentinput#installation)
  • [Usage] (https://github.com/smladeoye/yii2-dependentinput#usage)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

composer require smladeoye/yii2-dependentinput

or, (*4)

add '"smladeoye/yii2-dependentinput": "1.0.0"' to the require section of your composer.json file, then run:, (*5)

composer install

Usage

To use the widget, simply call it from your view and pass it the required parameters; Example:, (*6)


use smladeoye\dependentinput\DependentInputWidget; echo DependentInputWidget::widget( [ // set to true to display the default loader when ajax request is being made 'displayLoader' => true, // settings for the widget dependent element // this can be an array containg an array of settings or just one array with the setting 'options' => [ [ // the dependent element type - ("select" or "text") 'type' => 'select', // the dependent element parent/parents id without the # // the value can be a string or an array; // if it is an array, the array key is used to save the value //the value for the below input can be gotten from $_GET['params']['input1'] 'parent' => ['input1' => 'input1'], OR //the value for the below input can be gotten from $_GET['params'][0] // 'parent' => 'input1' // the dependent element id without the # 'child' => 'input2', // the url used for the ajax request 'url' => Url::to(), ], // another dependent element settings [ 'type' => 'text', 'parent' => ['input2'=>'input2'], 'child' => 'input3', 'url' => Url::to(), // you can set this value in cases where the dependent is an input and you // want to modify some attributes with the gotten result 'resultAttr' => ['max'], // you can also set the element attributes 'elementAttr' => ['max' => 0, 'value' => 'sweet', 'min' => 0] ], ], ] ); ?>

The request method used is GET; The controller action is passed a params array as the GET parameter containing all the parent values which can be identified by their respective keys., (*7)

The Versions

18/06 2017

dev-master

9999999-dev

Yii 2 Dependent Form Input

  Sources   Download

MIT

by Avatar smladeoye

yii2 jquery form javascript widget dependent smladeoye dynamic input