[Custom Input Masks] How i can use optional digit?
Forge component by Sara Gonçalves
Ex: I can have in my country 9 or 8 digits.

99999-9999 or 9999-9999

Hi Diego,

To define some parts in the mask as optional you should use [ ]. So you should choose a MaskText and the MaskDefinition should be "9999[9]-9999".

Thank you for using CustomMasks :)

I forgot one thing, you should also add to the AdvancedOptions "{greedy: false}".
This component is based on this plugin, you can check it to look for more advanced options.

Thank you Sara.

Its work :)

good job
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.