Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/462.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript codeigniter未验证输入文本_Javascript_Php_Jquery_Codeigniter_Validation - Fatal编程技术网

Javascript codeigniter未验证输入文本

Javascript codeigniter未验证输入文本,javascript,php,jquery,codeigniter,validation,Javascript,Php,Jquery,Codeigniter,Validation,我有一个密码更改表,提交时只有两个输入被验证,名为“确认新密码”的输入未被验证。我怎么了 请帮帮我 HTML和JS代码 $(function($) { $.fn.ajaxForm = function(url, data, msgHolderId) { var self = this; var result; return $(self).bind('submit', function(e) { e.preventD

我有一个密码更改表,提交时只有两个输入被验证,名为“确认新密码”的输入未被验证。我怎么了

请帮帮我

HTML和JS代码

$(function($) {
    $.fn.ajaxForm = function(url, data, msgHolderId) {
        var self = this;
        var result;
        return $(self).bind('submit', function(e) {
            e.preventDefault();
            if (data != null)
                data = "&" + $.param(data);
            alert(data);
            $.ajax({
                url: '<?= base_url() ?>' + url,
                async: false,
                cache: false,
                data: $(self).serialize() + data,
                type: 'POST',
                dataType: 'json',
                success: function(response) {
                    $('#' + msgHolderId).html(response.msg);
                }
            });
        });
    }
}(jQuery));

$(document).ready(function() {
    $('#password-change-form').ajaxForm('user/settings/password_change', null, 'msg-holder');
});

试试这个

$this->form_validation->set_rules('password', 'Password', 'required|matches[confirm-new-password]');
$this->form_validation->set_rules('confirm-new-password', 'Password Confirmation', 'required');
请尝试以下代码:

$this->form_validation->set_rules('current_pwd', 'Current password','required');
$this->form_validation->set_rules('new_pwd', 'New password' ,'required|min_length[6]|max_length[20]');
$this->form_validation->set_rules('confirm_pwd', 'Confirm password','required|matches[new_pwd]');
然后更改输入名称

$this->form_validation->set_rules('password', 'Password', 'required|matches[confirm-new-password]');
$this->form_validation->set_rules('confirm-new-password', 'Password Confirmation', 'required');
$this->form_validation->set_rules('current_pwd', 'Current password','required');
$this->form_validation->set_rules('new_pwd', 'New password' ,'required|min_length[6]|max_length[20]');
$this->form_validation->set_rules('confirm_pwd', 'Confirm password','required|matches[new_pwd]');