confirmation button

i have problem with CHtml:button…

i write like this.




echo CHtml::Button('Accept', array('submit' =>Yii::app()->createUrl("/adsBanner/accept", array("id" => $model->id_ads_banner)),'onClick'=>'confirm("Are you sure?")','name'=>'accept'));



when i click yes, action execute, but when i click no. action execute too.

how to resolve this??

Put it like this: (you missed the return keyword)

‘onClick’=>‘return confirm(“Are you sure?”);’

not work…

button “No” can’t working properly

can someone help me?

What you wrote is not compliant with CHtml:button() reference.

Instead:


echo CHtml::button('Accept', array('submit' =>Yii::app()->createUrl("/adsBanner/accept", array("id" => $model->id_ads_banner)), 'confirm'=>'Are you sure?', 'name'=>'accept'));