prashanth
(Prashanth Kvd)
1
Hi all i want to add the ajax functionality to the CHtml::checkBoxList,
my code is,
<?php echo CHtml::label(‘State’ ,’’); ?>
<?php echo CHtml::checkBoxList(
'state_name',
array(0),
CHtml::listData(State::model()->findAll(),'id','state_name'),
array('checkAll'=>'Select all States', 'checkAllLast'=>false,'container'=>'ul','ajax' => array(
'type'=>'POST',
'url'=>CController::createUrl('MyController/SetDistrict'),
'update'=>'#district_name',
))
); ?>
In this ajax works,but the problem is if i click on the check box it is not selected or deselected…can any one give me the right suggession…!
hi,
sample code to include the query function
echo $form->dropDownList($yourmodel,‘yourfieldtolink’, $yourresultset, array(‘empty’ => ‘-- Select–’, ‘style’ => ‘width:150px;’, “onChange” => “yourajaxfunction(optionalparams)”, “disabled” => ‘false’));
prashanth
(Prashanth Kvd)
3
Hi, kumarkulandai
You mean like this
<?php echo CHtml::label(‘State’ ,’’); ?>
<?php echo CHtml::checkBoxList(
‘state_name’,
array(0),
CHtml::listData(State::model()->findAll(),‘id’,‘state_name’),
array(‘checkAll’=>‘Select all States’, ‘checkAllLast’=>false,‘container’=>‘ul’,“onChange”=>‘ajax’ => array(
‘type’=>‘POST’,
‘url’=>CController::createUrl(‘MyController/SetDistrict’),
‘update’=>’#district_name’,
))
); ?>
i think it won’t work.
You can set ‘return’=>true in the html options to force returning true or non-false value.