In my form, I have given a confirmation message before saving.
CHtml::submitButton('Save', array('confirm'=>'Are you sure you want to save?'));
But the message box appears two times... What is wrong ?
In my form, I have given a confirmation message before saving.
CHtml::submitButton('Save', array('confirm'=>'Are you sure you want to save?'));
But the message box appears two times... What is wrong ?
Here is the form where you can got the answer of your thing... this is one way of doing it...!!!
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'customer-form-guest',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
'afterValidate' => 'js:function(form, data, hasError) {
if(hasError) {
alert("There are errors in form inputs please resolve it.");
}
else
{
var r = confirm("Are you sure y7ou want to do this ..?");
if(r == true)
{
return true;
}
else
{
return false;
}
}
}' ),
'htmlOptions'=>array('role'=>"form")));