Yii Framework Forum: Can't use dropdownlist to call action - Yii Framework Forum

Jump to content

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

Can't use dropdownlist to call action Rate Topic: -----

#1 User is offline   guiderof 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 29-June 12

Posted 29 June 2012 - 11:15 PM

Hi all,

I have Site/index.php
<?php echo CHtml::link('Project', array('/project'))?>
...
and
...
<?php echo CHtml::dropDownList('lang',$select,$language,array('empty'=>'-select-','submit'=>'/setLanguage/change')); ?>

project : controller
setLanguage/change : controller/action
all controller isn't Site's controller.

My link is work fine but dropdownlist is don't work.

It tell me "The requested URL /setLanguage/change was not found on this server".
because It make URL like this localhost/setLanguage/change.
but I expect to localhost/project/index.php/setLanguage/change.

I want to use dropdownlist to call an action by submit, but it don't work.
How to fix it?

Thanks.
0

#2 User is offline   kiran sharma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 498
  • Joined: 21-May 11
  • Location:India

Posted 30 June 2012 - 12:05 AM

Use this,

<?php echo CHtml::dropDownList('lang',$select,$language,array('empty'=>'-select-','submit'=>array('setLanguage/change'))); ?>

Thanks,
Kiran Sharma.
0

#3 User is offline   guiderof 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 29-June 12

Posted 30 June 2012 - 12:11 AM

View PostKiran Sharma, on 30 June 2012 - 12:05 AM, said:

Use this,

<?php echo CHtml::dropDownList('lang',$select,$language,array('empty'=>'-select-','submit'=>array('setLanguage/change'))); ?>



It's Work!!

Thank you.
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