Tag Archives: Yii Dropdownlist

Insert data into Dropdownlist by ajax request in yii

This turorial have the details of dynamic data insertion to dropdownlist using ajax. I added the source code below for this concept. We have two dropdownlist in form “usercategory”,”usertype”. When we change the usercategory, usercategory related usertype will show in “usertype” dropdownlist. In view.php <div class=”row”> <?php echo $form->labelEx($model,’usercategory’); ?> <?php $categories=Yii::app()->Datacomponent->usercategory(); echo $form->dropdownlist($model, ‘usercategory’, […]

CHtml dropDownList Ajax Submit

I added the code to submit the yii form When we select the value from Chtml dropdownlist box. <div class=”search-form” style=”display:block”> <div class=”wide form”> <?php $form=$this->beginWidget(‘CActiveForm’, array( ‘action’=>Yii::app()->createUrl($this->route), ‘method’=>’get’, )); ?> <div class=”row”> <?php echo $form->labelEx($model,’type’); ?> <?php $types=array(“1″=>”Type1″,”2″=>”Type2″); echo $form->dropDownList($model,’type’,$types, array( ‘onchange’=>CHtml::ajax(array( ‘success’=>”$(‘.search-form form’).submit()”, )), ) ); ?> </div> </div> </div>

CHtml Dropdownlist

Using CHtml class we are creating dropDownList in yii framework. This post will help you to understand about how to create dropDownList in different method, How to assign value, how to get dropDownList value in controller, dropDownList value from database, dropDownList validation in model yii framework. Default Empty DropDownList DropDownList Value In Controller DropDownList Event […]

Yii Framework 2 : DropDownList

“Do you know How to display the data in drop down list?” This tutorial will help you to display the array data or model data in drop down list in different way. Default DropDownList DropDownList With Prompt Text DropDownList With Model (DB) Data Default Selection DropDownList Default DropDownList Yii2.0 default dropdownlist syntaxt. <?php echo $form->field($model, […]