inputmask-core
inputmask-core copied to clipboard
allow special characters at the beginning of pattern
it stops work when you delete all characters from the input for pattern such as '(111) 111-1111', but still works for pattern '111) 111-1111'
Can you provide details on how to reproduce this?
A failing addition to the 'Leading static characters' test case would be ideal.
@agapas currently plugin expect that you provide mask characters if you insert at begin of input, like mask.paste('(123)456-7890')
@AuthorProxy Thanks for the clarification. I have the same issue with this pattern. Following your example, in order to work with (111)-111-1111
pattern, I'd need to do mask.paste('(1234567890')
, since I want it to be masked for me, and not actually provide masked input.
If I read the code correctly, the intented behaviour of mask.paste()
is to accept both masked and unmasked values (as mentioned here). Hovewer,
// If there are static characters at the start of the pattern and the cursor
// or selection is within them, the static characters must match for a valid
// paste.
the code that checks the first character does not account for unmasked value as the first charater, and has to match exactly the static charater (that is missing, since it's unmasked). Hence, mask.paste('1234567890')
will fail because of the first character, but mask.paste('(1234567890')
will succeed because the rest of the paste (after the first character) supports unmasked value.
This is not a dealbreaker, the workaround is to loop through the string and do mask.input(char)
instead, I just thought I'd clarify the issue we had working with this pattern.
thanks
not working mask.paste with +7(111)-111-11-11
Thank you i understand it. Sorry my bad english. Solution is mask.paste("+7(" + rest number)
.