Yii Framework Forum: Select Box Onchange For Select State By County And Onchange Search Result Not Working Simultaneously - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Select Box Onchange For Select State By County And Onchange Search Result Not Working Simultaneously Rate Topic: -----

#1 User is offline   bhavesh vaghela 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 26-December 12
  • Location:Ahmedabad

Posted 23 January 2013 - 09:16 AM

index.php file
<php
$('select').change(function(){

$('#gridDiv').show('fast');

$.fn.yiiListView.update('searchlist', {

data: $('form').serialize()
});
return false;
});



");


?>
<h1>Quick Search</h1>
<div class="search-form" style="width:100%">
<div style="width: 40%;float:left;">
<div >
<?php $this->renderPartial('_search1',array(
'model'=>$model,
)); ?>
</div><!-- search-form -->
</div>
<div style="width: 60%;float: right;">

<div id="gridDiv">
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$model->search(),
'itemView'=>'_view',

'id'=>'searchlist',
)); ?>
</div>
</div>

</div>

and search1.php file like

<div>
<?php echo $form->label($model,'talentrgd_country_id'); ?>
<?php
$country = new CDbCriteria;
$country->order = 'country_name ASC';
?>
<?php
echo $form->dropDownList($model,'talentrgd_country_id',CHtml::listData(Country::model()->findAll($country),'country_id','country_name'),
array(
'prompt'=>'Select country',
'ajax' => array(
'type' => 'POST',
'url' => CController::createUrl('quicksearch/dynamicstates'),
//'update' => '#talentrgd_state_id',
'update'=>'#Quicksearch_talentrgd_state_id',
'data'=>array('talentrgd_country_id'=>'js:this.value'),
)
)
);
?>
<?php echo $form->error($model,'talentrgd_country_id'); ?>
</div>

<div>
<?php echo $form->label($model,'talentrgd_state_id'); ?>
<?php
$allState = new CDbCriteria;
$allState->order = 'state_name ASC';
echo $form->dropDownList($model,'talentrgd_state_id',CHtml::listData(State::model()->findAll($allState),'state_id','state_name'),
array(
'prompt'=>'Select State',
'ajax' => array(
'type' => 'POST',
'url' => CController::createUrl('quicksearch/dynamiccities'),
'update'=>'#Quicksearch_talentrgd_city_id',
'data'=>array('talentrgd_state_id'=>'js:this.value'),
) ));

?>

when i click on country it show right result for searching but it not working to get state by country

Please help
Thanks in advance
0

#2 User is offline   VINAY Kr. SHARMA 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 13-September 11
  • Location:Gurgaon

Posted 30 January 2013 - 04:07 AM

Wrap your code within code tag for better view.

[code]
code here

[/code]
VINAY Kr. SHARMA
@vinaykrsharma
Facebook ID: vinaykrsharma
Blog

Co-operation comes from friendship, friendship comes from trust, and trust comes from kind-heartedness.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users