芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/cognitio_inquiry/js/mobilevalidate.js
jQuery(function($) { jQuery.validator.addMethod("country", function(value, element) { return this.optional(element) || /^[^+]/.test(value); }, "Enter Number Without Country Code"); jQuery.validator.addMethod("number", function(value, element) { return this.optional(element) || value.match(/^[1-9][0-9]*$/); }, "Invalid mobile number format"); jQuery.validator.addMethod("mobile", function(value, element) { return this.optional(element) || /^[6-9][0-9]{9}$/.test(value); }, "Please enter a valid mobile number"); jQuery.validator.addMethod("alphabets", function(value, element) { return this.optional(element) || /^[a-zA-Z ]*$/.test(value); }, "Please enter Alphabets only"); jQuery.validator.addMethod("email", function(value, element) { return this.optional(element) || /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(value); }, "Please enter a valid email address."); jQuery.validator.addMethod("intlTelNumber", function(value, element) { return this.optional(element) || $(element).intlTelInput("isValidNumber"); }, "Please enter a valid International Phone Number"); if ($("#contact_form").length > 0) { $("#contact_form").validate({ rules: { name: { required: true, }, mobile: { required: true, minlength: 10, maxlength: 10 }, email: { required: true, email: true }, city: { required: true, } }, message: { name: { required: "Please enter first name" }, mobile: { required: "Please enter mobile no", minlength: "Min 10 digit mobile number", maxlength: "Invalid mobile number" }, email: { required: "Please enter email", email: "Please enter valid email address" }, city: { required: "Please enter your city", } }, }); } if ($("#popup_form").length > 0) { $("#popup_form").validate({ rules: { name: { required: true, }, mobile: { required: true, minlength: 10, maxlength: 10 }, email: { required: true, email: true }, city: { required: true, } }, message: { name: { required: "Please enter first name" }, mobile: { required: "Please enter mobile no", minlength: "Min 10 digit mobile number", maxlength: "Invalid mobile number" }, email: { required: "Please enter email", email: "Please enter valid email address" }, city: { required: "Please enter your city", } }, }); } });