Yii Framework Forum: Passing An Array To An Action From A Partially Rendered View - Yii Framework Forum

Jump to content

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

Passing An Array To An Action From A Partially Rendered View Rate Topic: -----

#1 User is offline   eggshOt 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 18-September 12
  • Location:Philippines

Posted 09 October 2012 - 11:35 AM

I have this code in my partially rendered view:
echo CHtml::linkButton('Proceed', array(
     'submit'=>array('engineering/acquiredsubjects','subjects'=>$selectedsubj),
));


But it seems nothing is being passed to my controller action...
0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,601
  • Joined: 04-March 10
  • Location:UK

Posted 09 October 2012 - 12:27 PM

You'll need to serialise the array so that it can be processed.

Assuming you can use | as a delimiting character, try:
echo CHtml::linkButton('Proceed', array(
     'submit'=>array('engineering/acquiredsubjects','subjects'=>implode('|', $selectedsubj)),
));


Then in the controller:
$subjArr = explode('|', $subjects);

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