确认框为Yii按钮

时间:2015-11-26 16:53:03

标签: yii

我在我的网站上创建了一个按钮,它在我的CentOS中执行了一个脚本,但我正在寻找一个解决方案来放置一个确认框来执行操作。 按钮:

$attribs[] = array(
    'label' => Yii::t('mc', 'Instalar Technic -> B Team'),  
    'type' => 'raw', 
    'cssClass' => 'mpack',
    'value' => CHtml::ajaxButton(
        Yii::t('mc', 'Instalar B Team'), 
        '', 
        array(
       'type' => 'POST',
       'data' => array(
           'ajax' => 'bteam', 
           Yii::app()->request->csrfTokenName=>Yii::app()->request->csrfToken,),
           'success' => 'function(e) {
                if (e) alert(e);
           }'
        ),
        array('class' => 'btn btn-success btn-sm')),
        'hint' => Yii::t('mc', 'Servidor não liga? Este botão seta "true" na "eula.txt", é necessario isso para seu servidor ligar, cheque seu console para verificação.'),
        //Edit the hint option here 
);

1 个答案:

答案 0 :(得分:0)

您可以添加一个确认框,只需在链接中声明正确的数据限制

即可
'value' => CHtml::ajaxButton(
    Yii::t('mc', 'Instalar B Team'), 
    '', 
    array(
   'type' => 'POST',
   'data' => array(
       'ajax' => 'bteam', 
          Yii::app()->request->csrfTokenName=>Yii::app()->request->csrfToken,),
       'success' => 'function(e) {
            if (e) alert(e);
       }'
    ),
    array('class' => 'btn btn-success btn-sm', 
           'confirm' => "do you want confirm this action ?" ),

    ));