我有问题。有没有一种方法可以根据确认消息提供其他操作? 例如,我有这样的:基于Yii确认的渲染动作
<?php $this->widget('booster.widgets.TbButton', array(
'buttonType'=>'submit',
'context'=>'primary',
'htmlOptions' => array(
'id'=> 'createstudent',
'confirm' => 'Do you want to register the student to a class'
),
'label'=>$model->isNewRecord ? Yii::t('default', 'Create') : Yii::t('default', 'Save'),
)); ?>
而我想做的是当用户点击在确认对话框是的,我想渲染来自其他控制器的另一个动作。例如contract/studentcreate, array($model->studentid)
。如果用户点击否,它应该呈现假设呈现的动作。 谢谢你提前
弹出信息发生,但不管我点击了什么。它调用默认操作。它忽略了location.href命令 – thr
也许是因为你正在使用提交按钮。它当然有它自己的href动作(这将是表单的动作)。 这意味着您需要创建自己的按钮作为“a”链接。例如,替换TbButton小部件: Example 一旦你点击它,它href你到正确的行动。 当然,您将不得不根据自己的愿望编辑CSS样式。 – Mundo