這是我在這段代碼中的代碼一切正常,但文件提交沒有通過此代碼驗證。 所有輸入字段由該驗證插件除了申請文件類型驗證..我想我錯過了一些東西PLZ調試它使用jquery插件輸入文件驗證
$("#contactus_form").validate({
// Specify the validation rules
rules: {
name: "required",
contact: {
required:true,
maxlength: 10,
minlength: 10,
digits: true
},
degree: "required",
applying_for: "required",
experience: {
required:true,
// maxlength: 10,
digits: true
},
user_cv: {
//check:"required",
required: true,
extension: "doc|pdf"
},
email: {
required: true,
email: true
}
},
// Specify the validation error messages
messages: {
name: "Please enter your first name",
contact: "Please enter your contact number",
degree: "Please enter your Qualification",
experience: "Please enter your experience",
user_cv: "Please select Your Cv",
applying_for: "Please accept our policy",
email: "Please enter a valid email address"
},
});
<form action="" method="post" id="contactus_form" novalidate="novalidate" enctype="multipart/form-data">
<div class="form-group">
<input type="text" id="name" name="name" class="form-control contro" value="" placeholder="Name*" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Name*'">
</div>
<div class="form-group">
<input type="text" id="email" name="email" class="form-control contro" value="" placeholder="Email*" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Email*'">
</div>
<div class="form-group">
<input type="text" id="contact" name="contact" class="form-control contro" value="" placeholder="Contact Number*" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Contact number'">
</div>
<div class="form-group">
<!-- <input type="text" id="degree"class="form-control contro" value="" placeholder="Highest Degree*" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Highest Degree'">
-->
<select id="degree" name="degree" class="form-control">
<option value="">Not selected </option>
<option value="Graduation ">Graduation </option>
<option value="Post Graduation">Post Graduation </option>
</select>
</div>
<div class="form-group">
<input type="text" id="applying_for" name="applying_for" class="form-control contro" value="" placeholder="Applying For" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Applying For'">
</div>
<div class="form-group">
<input type="text" id="experience" name="experience" class="form-control contro" value="" placeholder="Experince in Year" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Experince in Year'">
</div>
<div class="form-group">
<div class="field">
<input type="file" name="user_cv" id="user_cv" class="inputfile inputfile-6" />
<label for="user_cv" class="file-upload"> <span class="form-control attach" id="user_cv_name">Upload Resume</span>
<strong class="browse-btn butn">Browse</strong></label>
</div>
</div>
<button id="submit" name="submit" type="submit" class="btn-style sub">SUBMIT</button>
</form>
在哪裏'的validate()'?命名你的圖書館。 – Pete