ngx-mask icon indicating copy to clipboard operation
ngx-mask copied to clipboard

Different form control value (regarding inclusion of prefix) when 'dropSpecialCharacters' is on/off

Open i-knezevic-milan opened this issue 3 years ago • 1 comments

Version: ^13.1.1 + Angular

If I have

mask = "B*" prefix = "foo/" patterns= { 'B': { pattern: new RegExp('.') } }

And I have some input where I type bar

When input looks like this (without dropSpecialCharacters) <input [mask]="mask" [prefix]="prefix" [patterns]="patterns"> Then form value associated with this input is bar (prefix IS NOT included)

When I add dropSpecialCharacters <input [mask]="mask" [prefix]="prefix" [patterns]="patterns" [dropSpecialCharacters]="false"> Then form value associated with this input is foo/bar (prefix IS included)

This also means that validation of this input differs (e.g. if field is required and I don't type anything, in the first case it is considered as empty (which is what I want) and in the second case form has the same value as prefix so it's not empty)

i-knezevic-milan avatar Jun 14 '22 09:06 i-knezevic-milan

validation check is wrong when dropSpecialCharacters : false is used, it includes the prefix in the checking of the mask. please if there's any news let us know

Nabeeh-AlSawaf avatar Sep 10 '22 04:09 Nabeeh-AlSawaf

@Nabeeh-AlSawaf @i-knezevic-milan Thanks for your using Ngx-Mask. Please update to latest version. It example, all work as expected - https://stackblitz.com/edit/angular-6e7nns?file=src%2Fmain.ts

andriikamaldinov1 avatar May 29 '23 10:05 andriikamaldinov1