
   <?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'changepassword-form',
    'enableAjaxValidation' => false,
    'enableClientValidation' => false,
));
?>

<div class="tab-content">
    <div class="tab-pane active" id="tab1">
        <ul class="clearfix form-ul material">
            <li class="col-sm-4">
                <input type="password" name="user_current_password" id="user_current_password" data-label="Enter Current Password">
            </li>

            <li class="col-sm-4">
                <input type="password" name="user_new_password" id="user_new_password" data-label="Enter New Password">
            </li>
            <li class="col-sm-4">
                <input type="password" name="user_reenter_password" id="user_reenter_password" data-label="Renter New Password">
            </li>
        </ul>
    </div>
</div>
     <div class="modal-footer">
            <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                 <?php echo CHtml::ajaxSubmitButton('Reset', Yii::app()->createUrl('site/updatePassword'), array(
    'dataType' => 'json',
    'type' => 'post',
    'success' => 'function(data) {
                                if(data.status=="success"){
                                    location.href=$("#liveSite").val()+"index.php?r=site/logout";
                                    t8.success("Password Changed","success");

                                }
                                else
                                {
                                    if(data.status=="fail"){
                                        t8.error("Current Password Incorrect. Please Try Again","error");
                                    }
                                    loadPopupModal("site/changepassword","Change Password","lg");
                                }
                            }',
    'beforeSend' => 'function(){
                            var cur_pwd     = $("#user_current_password").val();
                            var new_pwd     = $("#user_new_password").val();
                            var re_pwd      = $("#user_reenter_password").val();
                            if(cur_pwd=="")
                            {
                                $("#user_current_password").addClass("error");
                                $("#div_changepassword_error").html("Please enter Current Password");
                                return false;
                            }
                            else if(new_pwd=="")
                            {
                                $("#user_current_password").removeClass("error");
                                $("#user_new_password").addClass("error");
                                $("#div_changepassword_error").html("Please enter New Password");
                                return false;
                            }
                            else if(re_pwd=="")
                            {
                                $("#user_current_password").removeClass("error");
                                $("#user_new_password").removeClass("error");
                                $("#user_reenter_password").addClass("error");
                                $("#div_changepassword_error").html("Please Reenter New Password");
                                return false;
                            }
                            else if(re_pwd!=new_pwd)
                            {
                                $("#user_new_password").addClass("error");
                                $("#user_reenter_password").addClass("error");
                                $("#div_changepassword_error").html("Password not matching");
                                return false;
                            }else{
                                $("#user_current_password").removeClass("error");
                                $("#user_new_password").removeClass("error");
                                $("#user_reenter_password").removeClass("error");
                                $("#div_changepassword_error").html("");

            
                            }
                        }',
    'complete' => 'function(){
                $("#changepassword-form .maintenance-save-btn").prop("disabled", false);
                }',
), array('id' => 'mybtn' . rand(), 'class' => 'maintenance-save-btn btn btn-primary')); ?>

                              </div>
 <?php $this->endWidget();?>
</ul>