Yii Framework Forum: Can not pass value different page - Yii Framework Forum

Jump to content

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

Can not pass value different page Rate Topic: -----

#1 User is offline   nemo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 24-February 10

Posted 25 June 2010 - 07:32 AM

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));
}
0

#2 User is offline   Jaz Manister 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 109
  • Joined: 27-October 09
  • Location:Rural Western New York, USA

Posted 25 June 2010 - 08:49 AM

View Postnemo, 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?
0

#3 User is offline   nemo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 24-February 10

Posted 25 June 2010 - 09:01 AM

View PostJaz 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.
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