Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom placeholders in formatCharacters #42

Open
andreasvirkus opened this issue Apr 5, 2018 · 0 comments
Open

Allow custom placeholders in formatCharacters #42

andreasvirkus opened this issue Apr 5, 2018 · 0 comments

Comments

@andreasvirkus
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant