Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. change: function(self, newValue) {
  2.                         var numbers = '0123456789';
  3.                         if(newValue && newValue.length == 2 && ~numbers.indexOf(newValue.charAt(1))) {
  4.                             //Введено 2 символа, и второй число. Значит пытаются ввести код МКБ
  5.                             var latChar = 'qwertyuiopasdfghjklzxcvbnm';
  6.                             var cirChar = 'йцукенгшщзфывапролдячсмить';
  7.                             //Индекс первого символа
  8.                             var index = cirChar.indexOf(newValue.charAt(0));
  9.                             if(index != -1) {
  10.                                 var newValueStr = latChar.charAt(index) + newValue.substring(1);
  11.                                 self.setRawValue(newValueStr);
  12.                             }
  13.                         }
  14.                     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement