Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About kokozimar

  • Rank
  1. Thanks but doesn't working. Just correct: !(/^[A-Z;0-9;][a-zA-Z0-9-]*$/i).test(f.value)?f.value = f.value.replace(/[^A-Z;0-9;][a-zA-Z0-9-]/ig,''):null; And already fixed. Thanks all for help.
  2. <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <script src="http://code.jquery.com/jquery-2.1.1.js"></script> <input type="text" class="text" name="part_numb" id="part_numb" value="" onkeyup="valid(this)" onblur="valid(this)" required> <script type="text/javascript"> function valid(f) { !(/^[A-Z;0-9;-]*$/i).test(f.value)?f.value = f.value.replace(/[^A-Z;0-9;-]/ig,''):null; } $('body').on('input', 'input[name=part_numb]', function() { $(this).val($(this).val().replace('a', 'A')); $(this).val($(this).val().replace('b', 'B')); $(this).val($(this).val().replace('c', 'C')); $(this).val($(this).val().replace('d', 'D')); $(this).val($(this).val().replace('e', 'E')); $(this).val($(this).val().replace('f', 'F')); $(this).val($(this).val().replace('g', 'G')); $(this).val($(this).val().replace('h', 'H')); $(this).val($(this).val().replace('i', 'I')); $(this).val($(this).val().replace('j', 'J')); $(this).val($(this).val().replace('k', 'K')); $(this).val($(this).val().replace('l', 'L')); $(this).val($(this).val().replace('m', 'M')); $(this).val($(this).val().replace('n', 'N')); $(this).val($(this).val().replace('o', '0')); $(this).val($(this).val().replace('O', '0')); $(this).val($(this).val().replace('p', 'P')); $(this).val($(this).val().replace('q', 'Q')); $(this).val($(this).val().replace('r', 'R')); $(this).val($(this).val().replace('s', 'S')); $(this).val($(this).val().replace('t', 'T')); $(this).val($(this).val().replace('u', 'U')); $(this).val($(this).val().replace('v', 'V')); $(this).val($(this).val().replace('w', 'W')); $(this).val($(this).val().replace('x', 'X')); $(this).val($(this).val().replace('y', 'Y')); $(this).val($(this).val().replace('z', 'Z')); $(this).val($(this).val().replace(' ', '')); $(this).val($(this).val().replace('-', '-')); }); </script> </body></html> Hi all again, May be it's little bit stupid wrote, but it's the way it's almost work. I complied almost all rules. But the rule to not start with '-' I haven't idea how to realize. Please help me. Thanks in advance.
  3. Could someone help me with restrictions for input text? <input type = text size = 18 name = part_numb value = '' pattern = '([A-NP-Z0-9 -]). {0,50}' id = 'part_numb' required> In this case, it's not working. My restrictions are: The value can't content letter "O", auto-replacement with number "0" The value can't content small letters, only Capital. (auto-replacement) The value can't content special symbols except "-" but the value can't start or finish with "-" (auto-removal) The value can't content free spaces. (auto-removal) 5. This input is required. The symbols have to be "A-N", "P-Z", "0-9", "-" I thinks that have to use "onChange", but I am not sure. Please excuse me if this topic is not for here. Thanks in advance.
  • Create New...