validator icon indicating copy to clipboard operation
validator copied to clipboard

Bug - pattern does reject input incorrectly

Open JANHMS opened this issue 2 years ago • 2 comments

Thanks for creating this tool. I copied the .js file and included it in my HTML script:

   <script src='./validator.js'></script>

I was trying to use it in my HTML code like so:

<div class="row">
  <div class="col">
      <div class="form-group">
          <label for="name">name</label>
          <input pattern="alphanumeric" data-validate-length-range="2" data-validate-words="1" name="name" placeholder="Mustermann" required="required" class="form-control" type="text" value="{{item.name}}">
      </div>
  </div>

However this does not work. I just type characters like <Name> and I receive an issue, that the field does not fullfil the pattern, even though it should work fine -> so a False Positive. However, it works fine, when I do not use the pattern variable, but fails with it. I also tried to use numeric and then type e.g. 12345, which did not work neither.

Any idea? (I tried on Edge)

JANHMS avatar Jan 26 '23 14:01 JANHMS

And what was the false-positive input which you were typing? "alphanumeric" is only alphabetical letters & numbers. Not < or < characters, so an input such as the one you have mentioned above - <12345> should be marked as invalid, as can be seen in this project's demo page:

http://yaireo.github.io/validator

https://user-images.githubusercontent.com/845031/214960680-b94c0414-61c8-4df7-844a-24f696ddc30b.mp4

yairEO avatar Jan 26 '23 21:01 yairEO

Yes I typed 12345 not <12345>.

JANHMS avatar Jan 27 '23 10:01 JANHMS