Answer the question
In order to leave comments, you need to log in
How to display a message in Russian about the incorrect filling of a field in which method: digits is used?
To validate the credit card form, I use the plugin - Jquery Validation Plugin.
1) Registered verification methods for name attributes, so that if the fields are filled incorrectly, an error message appears (displayed in English).
2) For attribute
cvcCodeused the method of checking required (Displaying a message about an empty field) and digits (filling the field with only numbers). Further, in messages I duplicated this code with similar rules, but instead of true, I wrote an error message that should have been displayed in Russian.
$ (function() {
$("#validateForm").validate({
rules: {
cardNumber:{
required: true,
digits: true
},
cardNumber1:{
required: true,
digits: true
},
cardNumber2:{
required: true,
digits: true
},
cardNumber3:{
required: true,
digits: true
},
cardOwner:{
required: true,
minlength: 4
},
cvcCode:{
required: true,
digits: true
},
},
// вывод сообщений об ошибке
messages: {
cardOwner: {
required: "Введите имя латинскими буквами, например: 'SERGEY'",
minlength: "Имя должно состоять не меньше чем из 4-х букв"
},
cvcCode: {
required: "Введите номер из 3-x цифр"
digits: "В данное поле вводятся только цифры"
}
}
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question