【问题标题】:calling action when button clicked单击按钮时调用操作
【发布时间】:2013-10-08 17:12:17
【问题描述】:

我想在单击按钮时调用一个动作。 我有一个接受请求的按钮,所以当我单击此按钮时,我想调用操作actionRequestAcceptence,但无需单击按钮即可自动调用此操作。

代码如下:

CHtml::imageButton($src.'accept.ico', array('id'=>'accept', 'onClick'=>$this->actionRequestAcceptence($modelr[$j]->idRequest, $model->idUser),'confirm'=>'are you sure?','style'=>'width:32px;height:32px'));

那么问题出在哪里?

【问题讨论】:

标签: php yii onclick action


【解决方案1】:

好吧,没什么奇怪的,因为您正在调用 actionRequestAcceptence 而不是建立指向此操作的链接...您应该尝试:

$imageButton = CHtml::imageButton($src.'accept.ico', array('style'=>'width:32px;height:32px'));
$url = array('requestAcceptence','idRequest'=>$modelr[$j]->idRequest,'idUser'=>$model->idUser);
echo CHtml::link($imageButton, $url, array('id'=>'accept', 'confirm'=>'are you sure?'));

您应该根据您的操作参数名称修改 idRequestidUser

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-26
    • 2012-05-01
    • 2020-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-04
    相关资源
    最近更新 更多