insin / insin/inputmask-core

Allow custom placeholders in formatCharacters

Open
#42 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
303
Forks
51
PR merge metrics
No merged PRs in 30d

Description

I propose an addition to the API where you could add a placeholder element to override
the default placeholder character via `formatCharacters`.

Current behaviour: all characters are applied the same placeholder character, no matter the pattern.

Proposed behaviour: all symbols get the same placeholder character _by default_ but it can be overwritten when passing in a pattern, like:
```
var mask = new InputMask({
pattern: '11ww', // An uppercase letter followed by 5 word characters
formatCharacters: {
'w': {
validate: function(char) { return /\w/.test(char) }
transform: function(char) { return char.toLowerCase() },
placeholder: 'A'
}
}
})

// results in
_ _ A A
```

Or a separate option after `formatCharacters` so we could also override the placeholders
for `0`, `A`, `a`?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.