colorbox和jquery - 验证插件在iframe中不起作用

时间:2013-10-21 23:32:18

标签: jquery forms iframe jquery-validate colorbox

我正在使用colorbox打开我希望使用jquery.validation插件的注册表单。问题是,有时验证是有效的,有时候它没有。我已尝试将验证简单地包含在加载到iframe中的html中,并且我尝试使用onComplete表示法加载它,如下所示:

       ....
    onComplete:
    $(document).on('blur', '#name', function() {
            alert("Handler for .blur() called.");
        })

我也试过这个:

onComplete:
    $("#name").blur(function() {
    alert("Handler for .blur() called.");
}),

以下是我的完整验证尝试 - 我只获得了必填字段,而不是minlenths或自定义消息。

$( "#signupForm" ).validate({
    rules: {
    name: "required",
    username: "required",
    email: {
          required: true,
          email: true   },
    password: {
        required: true,
        minlength: 5  },
    confirmPassword: {
        required: true,
        minlength: 5,
        equalTo: "#password"
    }
     },
    messages: {
        name: "Please enter your full name",
        username: "Please enter your username",
        email: {
            required: "Please enter your email address",
            email: "Email addresses are of the form user@host."
            },
        password: {
            required: "Please provide a password",
            minlength: "Your password must be at least 5 characters long"
        },
        confirmPassword: {
            required: "Please provide a password",
            minlength: "Your password must be at least 5 characters long",
            equalTo: "Please enter the same password as above"
        }
    }

});

最后,这是我表格的一部分 -

<input id="name" name="name" type="text" class="text" placeholder="Full Name" required />

...

真的有两个问题 - 首先是,为什么只有一段验证在彩盒中开始,其次,为什么我的&#34;在模糊&#34;不工作?我想用模糊来做一些ajax工作 -

0 个答案:

没有答案