Yii Form And Html Tutorials

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>... Read More »

CHtml dropDownList Ajax

I added the code for yii dropdownlist to the following actions like Dropdownlist ajax, Ajax response etcCHtml dropDownList: AjaxCHtml dropDownList: Ajax Response(Ex1)CHtml dropDownList: Ajax Response(Ex2)CHtml dropDownList: Ajax Response(Ex3)CHtml dropDownList: Ajax <?php /** CHtml dropDownList Ajax**/ $type=array("1"=>"Type 1","2"=>"Type 2"); echo $form->dropdownlist( $model, 'type', $type, array( 'empty'=>'Select Type', 'ajax'=>array( 'type'=>'POST', 'url'=>CController::createUrl('user/type'), 'data'=>array('typeid'=>'js:this.value'), ), ) ); ?> CHtml dropDownList: Ajax Response(Ex1) <?php /** Update After Get Response **/ $type=array("1"=>"Type 1","2"=>"Type 2"); echo $form->dropdownlist( […]... Read More »

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 EmptyDropDownListDropDownList Value In ControllerDropDownList EventDefault EmptyEmpty string, specifies the text corresponding to empty selection. Its value is empty. The ’empty’ option can also be […]... Read More »