Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.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 类型文件和其他验证的jQuery表单验证程序不工作_Javascript_Jquery_File_Validation_Jquery Form Validator - Fatal编程技术网

Javascript 类型文件和其他验证的jQuery表单验证程序不工作

Javascript 类型文件和其他验证的jQuery表单验证程序不工作,javascript,jquery,file,validation,jquery-form-validator,Javascript,Jquery,File,Validation,Jquery Form Validator,我使用了asp.NETMVC和jquery表单验证程序 我已经在类型文件html上应用了jquery表单验证程序 当用户上传的文件超过定义的大小时,我在哪里必须停止提交 请调查一下 在fiddle中,它工作得很好,但在我的代码中,它并没有像预期的那样工作 我的代码: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <

我使用了asp.NETMVC和jquery表单验证程序

我已经在类型文件html上应用了jquery表单验证程序

当用户上传的文件超过定义的大小时,我在哪里必须停止提交

请调查一下

在fiddle中,它工作得很好,但在我的代码中,它并没有像预期的那样工作

我的代码:

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>

    <h2>FileUpload</h2>

    <form action="~/home/FileUpload" id="registration-form" enctype="multipart/form-data">
        <p>
            E-mail
            <input name="email" data-validation="email">
        </p>
        <p>
            User name
            <input name="user" data-validation="length alphanumeric"
                   data-validation-length="3-12"
                   data-validation-error-msg="User name has to be an alphanumeric value (3-12 chars)">
        </p>
        <p>
            Password
            <input name="pass_confirmation" data-validation="strength"
                   data-validation-strength="2">
        </p>
        <p>
            Repeat password
            <input name="pass" data-validation="confirmation">
        </p>
        <p>
            Birth date
            <input name="birth" data-validation="birthdate"
                   data-validation-help="yyyy-mm-dd">
        </p>
        <p>
            Country
            <input name="country" id="country" data-validation="country">
        </p>
        <p>
            Profile image
            <input name="image" type="file" data-validation="mime size required"
                   data-validation-allowing="jpg, png"
                   data-validation-max-size="100kb"
                   data-validation-error-msg-required="No image selected">
        </p>
        <p>
            User Presentation (<span id="pres-max-length">100</span> characters left)
            <textarea name="presentation" id="presentation"></textarea>
        </p>
        <p>
            <input type="checkbox" data-validation="required"
                   data-validation-error-msg="You have to agree to our terms">
            I agree to the <a href="..." target="_blank">terms of service</a>
        </p>
        <p>
            <input type="submit" value="Validate">
            <input type="reset" value="Reset form">
        </p>
    </form>

    <script>

       $.validate({
    modules : 'location, date, security, file',
    onModulesLoaded : function() {
      $('#country').suggestCountry();
    }
  });

  // Restrict presentation length
  $('#presentation').restrictLength( $('#pres-max-length') );
    </script>

文件上传

电子邮件

用户名

密码

重复密码

出生日期

国家

轮廓图像

用户演示文稿(左100个字符)

我同意这个建议

美元。验证({ 模块:“位置、日期、安全性、文件”, onModulesLoaded:function(){ $(“#国家”).suggestCountry(); } }); //限制演示文稿长度 $(“#表示”)。限制长度($(“#pres max length”);
提交时未激活验证。未显示任何错误。在我的申请中,它提交的表格没有错误


您能编辑您的帖子使其更清晰吗?并解释到底什么不起作用。@Edwin我已经更新了问题,请复查;