RobinHerbots / Inputmask

Input Mask plugin

Home Page:https://robinherbots.github.io/Inputmask/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

State of alternator not reset with `clearIncomplete = true`

fanste opened this issue · comments

commented

Tested using 5.0.9-beta.6
JSFiddle: https://jsfiddle.net/mxLs0eqj/2/

Input is configured with

Inputmask({
    // complex alternator mask as optional is working as expected
    mask: '(*-******)|(*-******-**)|(*-******-**-**)|(*-******-**-**-**)|(*-******-**-**-**-**)|(*-******-**-**-**-**-***)',
    clearIncomplete: true,
    keepStatic: true
})

If you type in 12345678 to get to the second mask and then leave the input, the input is cleared, Thats OK.
image

But then you can't enter a value matching the first mask until backspace is pressed. The internal state only then seems to be cleared as well and the input still expectes a value matching the second (or higher) mask. A value matching the first mask is always rejected and cleared again.
image.

commented

A not so nice workaround is to add:

, onincomplete: function() {
    this.inputmask.setValue('');
}

@fanste ,

I pushed 5.0.9-beta.7

commented

Same behavior as before. The changes in beta.7 do not fix this issue.

Hmm, isn't this a caching issue?

commented

No, unfortunately it isn't a caching issue. I just tried in on your jsfiddle and even reloaded the page with Strg+F5.

  • Hover the field. Placeholder _-______ is shown
  • Focus the field. Placeholder _-______ is shown
  • Enter 1234567
  • Blur the field, value is accepted.
  • Add 8 to the previous sequence
  • Blur the field, value is cleared.
  • Hover the field. Placeholder _-______ is shown
  • Focus the field. Placeholder _-______-__ is shown
  • Enter 1234567
  • Blur the field, value is cleared
  • Focus the field again (_-______-__ is still displayed)
  • Press backspace, placeholder changes to _-______.
  • Enter 1234567
  • Blur the field, value is accepted

@fanste ,

You were right. I pushed version 5.0.9-beta.9 which should fix it. Can you have a try.

commented

Bug is fixed with the new version. Thanks!