But i want to make dependent i want to save selected value in any variable and shows them but if i echo $records or $ list they just show word (ARRAY) not full array i just want to save selected value in any variable so i pass that value into another dropdown please help i m stuck here more than 1 week please help i will waiting for any one help[/b]
yes i read this topic but i cant understand i show u my view and cotroller code
Actually i make my controller ,model,and views through crude but on index page i redirect my own view so i do nothing in my crud controller i just put my above code in my view its working fine it fetches data from database also saving value in database from dropdown but i have another drop drown which i want to make dependent on first drop down 4908
I make crud of tehsil table And on crud index page i redirect my own page its working fine get value from database and also send but i want to make a dependent dropdown i want to save selected drop down value and pass to other next drop down
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'Tehsil',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<div class="row"style=" background-color:#FFF5EE">
<?php echo $form->labelEx($model,'date'); ?>
<?php //echo $form->textField($model,'start_date_time'); ?>
<?php
Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker',array(
'language'=>'',
'model'=>$model,
'attribute'=>'date',
'mode'=>'datetime',
'options'=>array(),
'htmlOptions'=>array('readonly'=>true)
));
?>
<?php echo $form->error($model,'date'); ?>
</div>
</br>
<table style=" background-color:#FFF5EE">
<tr>
<td>
<h5>Tehsil</h5>
<?php
$records = Month::model()->findAll();
$list = CHtml::listData($records, 'name', 'name');
echo $form->dropDownList($model,'name', $list, (array('prompt'=>'Select name')));
echo $form->error($model,'name');
?>
</td><td><h5>union Council/ward</h5>
<?php
//$name="name = '$list' "; i want to pass here above drop down selected value i tried like this but it just show ARRAy without value and indexes <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />??
//$name ="$records";
//echo $name;
//exit();
//$records = Month::model()->findAll($name);
$records = Month::model()->findAllBySql(('SELECT * from month where name=name'),'id', 'name');
$list = CHtml::listData($records, 'union', 'union');
echo $form->dropDownList($model,'unionname', $list, array('prompt'=>'Select name'));
echo $form->error($model,'unionname');
?></td></td><td><h5> Month</h5>
<?php
$records = Month::model()->findAll();
$list = CHtml::listData($records, 'month', 'month');
echo $form->dropDownList($model,'month', $list, array('prompt'=>'Select name'));
echo $form->error($model,'month');
?>
Server side … PHP generates the initial page. It has 2 dropdowns. One is filled with options, and the other may be empty at this moment. The page also has a javascript to handle the following action in the client side. And the page is sent to the user’s browser.
Client side … The user selects an item in the 1st dropdown. This action causes the javascript to send back the selected item to the server via ajax call.
Server side … PHP gets the selected item and generates the content of the 2nd dropdown according to the selection. The content is send to the user’s browser via ajax response.
Client side … The javascript receives the response and updates the content of the 2nd dropdown.
You can not pass the selected value of the 1st dropdown to the 2nd one directly in one shot as you are trying to do in your view script.