update
This commit is contained in:
58
Static/script/jQuery/validate.sendContact.js
Normal file
58
Static/script/jQuery/validate.sendContact.js
Normal file
@@ -0,0 +1,58 @@
|
||||
$(document).ready(function () {
|
||||
$('#sendContactForm').submit(function () {
|
||||
$('._phone').each(function () {
|
||||
this.value = this.value.toString().split(" ").join("").split("-").join("");
|
||||
});
|
||||
});
|
||||
|
||||
$.validator.addMethod(
|
||||
"regex",
|
||||
function (value, element, regexp) {
|
||||
var check = false;
|
||||
var re = new RegExp(regexp);
|
||||
return this.optional(element) || re.test(value);
|
||||
},
|
||||
"pole musi zawierać tylko litery"
|
||||
);
|
||||
|
||||
$('#sendContactForm').validate({
|
||||
rules: {
|
||||
|
||||
name: {
|
||||
required: true
|
||||
},
|
||||
surname: {
|
||||
required: true
|
||||
},
|
||||
email: {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
phone: {
|
||||
required: true
|
||||
},
|
||||
message: {
|
||||
required: true
|
||||
},
|
||||
hiddenRecaptcha: {
|
||||
required: function () {
|
||||
if (grecaptcha.getResponse() == '') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
errorElement: "p",
|
||||
errorClass: "warning"
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function recaptchaCallback() {
|
||||
$('#hiddenRecaptcha').valid();
|
||||
}
|
||||
;
|
||||
Reference in New Issue
Block a user