Hey Guys
I have little problem when I pass the value one page to another. From page one, I have dropdown from different table and want to pass the value (start_date) to another page. here is my view file
page1 view file:
<tr>
<td><?php echo CHtml::activeLabel($form,'start_date'); ?></td>
<td><?php
$criteria = new CDbCriteria;
$criteria->order = 'start_date';
echo CHtml::activeDropDownList($form,'start_date',CHtml::listData(Test::model()->findAll($criteria),'id','start_date'), array('prompt'=>'Please select Start Date'));
?></td>
</tr>
page 1 controller
public function actionReport()
{
$form=new TestEx;
if(isset($_POST['TestEx']))
{
$form->attributes=$_POST['TestEx'];
if($form->validate())
{
$this->redirect(array('view','L_id'=>$form->L_id,'TestP_id'=>$form->TestP_id,'Test_i_id'=>$form->Test_i_id,'TestC_id'=>$form->TestC_id,'Start_date'=>$form->start_date));
}
}
$this->render('report',array('form'=>$form));
}
Page 1 of 1
Can not pass value different page
#2
Posted 25 June 2010 - 08:49 AM
nemo, on 25 June 2010 - 07:32 AM, said:
$this->redirect(array('view','L_id'=>$form->L_id,'TestP_id'=>$form->TestP_id,'Test_i_id'=>$form->Test_i_id,'TestC_id'=>$form->TestC_id,'Start_date'=>$form->start_date));
If I'm right on this, by doing the redirect, these variables will be available in the actionView method as $_GET parameters. You would then have to pass whatever information you still need to the render function. Why not just call render here and pass the $form object? $this->render('view',array('form'=>$form)); Does this help at all?
#3
Posted 25 June 2010 - 09:01 AM
Jaz Manister, on 25 June 2010 - 08:49 AM, said:
If I'm right on this, by doing the redirect, these variables will be available in the actionView method as $_GET parameters. You would then have to pass whatever information you still need to the render function. Why not just call render here and pass the $form object? $this->render('view',array('form'=>$form)); Does this help at all?
problem solved. I declare variable in my model. that it. thanks.
Share this topic:
Page 1 of 1

Help












