I'm a beginner, just started playing with my first project and wanted to know how to put a mandatory A in front of the ID number. (example of ID number: A1234567, seven numbers)At the moment, the insertion of the A is being completely manual, but I need it to be something automatic (and preferably that it is not possible to delete) For example, if you type 123456, it must be/show A123456.
I'm trying using Custom Mask and still think that I can do this in the Pattern/Expression of the mask, but don't know how. Is there a way where I can put a expression in the Pattern (at the mask Properties) and make it work?? If it doesn't work, is there other way i can make it?? Sorry if I marked the wrong tags, and if it's a idiot question.
Hi Gustavo,
To clarify a few things, I'm using the Input Mask Reactive asset.
Using the InputPatternMask block, you just need to set the id of the input and the pattern as I mentioned above.
Take a look at the demo of the asset which you can download on the page of the component to see how it works. You need to 1) have an input and give it a name:
And 2) drag the below next to the input and fill in the properties like below:
You should not change any JavaScript nor anything in the component. Just reference the block to your module, drag it to the screen and fill the inputs accordingly and your result will be like this:
Kind Regards,João
Masks are used to precisely achieve this goal. You should achieve your use case with the pattern {A}0000000
You can check more information on the patterns in https://imask.js.org/guide.html#masked-pattern.
Hi,
I'm putting the pattern you just pass in the mask properties, is that the correct place to put it?Cause when I enter the web page a pop up with this error on top of the image appears.
I saw that the code is in JS:
var patternMask = IMask(element, { mask: '{#}000[aaa]/NIC-`*[**]' }); var masked = IMask.PatternMasked({ mask: '{#}000[aaa]/NIC-`*[**]' });
But how do I put this in code? Can you recommend me any tutorial or website?
Really appreciate your help with this matter.
:)
It worked!!! Thanks <3
Hi Joao,
I came across your post, with similar case on masking input, but I'm looking for email masking with specific domain name, such as <name>@yourcompanydomain.com, where user will only need to replace <name> with their own email, and '@yourcompanydomain.com' will stay.
Been looking for some answer but could not find any.