P
P
Pavel2018-03-04 01:14:02
JavaScript
Pavel, 2018-03-04 01:14:02

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

cvcCode
used 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: "В данное поле вводятся только цифры"
      }
    }
  });
});

3) In the console, the browser indicated a syntax error in the line with the digits.
5a9b1d377c937564441834.jpeg

The question is, how to fix this error and set up a message in Russian about incorrect filling in the form using the digits check method (filling the element with numbers only)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2018-03-04
@KickeRockK

Have you tried putting a comma at the end of the line?

cvcCode: {
        required: "Введите номер из 3-x цифр",
        digits: "В данное поле вводятся только цифры"
      }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question