zipzapduo
(Zipzapduo)
March 13, 2012, 11:36pm
1
My code:
<?php
echo CHtml::ajaxButton ("All",CController::createUrl('user/grantAllRoles',array('user'=>$model->idUser)),
array('type' => 'POST',
'data' =>array('userrole'=>$model),
),array('id'=>'selectAll')
);
?>
My browser answer:
you’re not allowed to perform this action.
why?
Balu
(Mbalu123)
March 14, 2012, 7:40am
2
Add acces in your user controller
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view','GrantAllRoles'),
'users'=>array('*'),
),
}
tof
(Christophe Boulain)
March 14, 2012, 7:46am
3
Hmmm, I don’t think this is the problem, but CreateUrl is not a static method, you can’t call it like this.
You should use $this->createUrl(), or Yii::app()->createUrl()
Also, you may check your UserController accessRules
Balu
(Mbalu123)
March 14, 2012, 9:42am
4
check the below code this may help you.
<?php echo CHtml::ajaxSubmitButton(Yii::t('job','Create Job'),CHtml::normalizeUrl(array('job/addnew','render'=>false)),array('success'=>'js: function(data) {
$("#Person_jid").append(data);
$("#jobDialog").dialog("close");
}'),array('id'=>'closeJobDialog')); ?>