filamentgroup/politespace

Don't format the text on password inputs

Closed this issue · 1 comments

We're having one case where we don't want to format input text on blur. We have a social security input, which has a format of xxx-xx-xxxx, and has a toggle checkbox to show/hide the text in the field. When you click to hide the text in the field, the input is turned into a password type. In this case, we don't want any formatting to happen on blur because it confuses users since extra * are added to the now, password field.

I was thinking this could be solved of one of two ways:

  • Provide a method on the politespace jQuery object to temporarily unbind the blur event to format the text.
  • Ensure the formatting on the blur event doesn't happen at all to inputs of type password.

I could potentially submit a PR, but would appreciate what direction would be better.

Thanks for writing this code!

This is now included in the library. See https://github.com/filamentgroup/politespace/blob/master/src/politespace.js#L96

For a demo, see the Masked Input example on http://filamentgroup.github.io/politespace/demo/demo.html using the following JS code to handle the password toggle to text: http://filamentgroup.github.io/politespace/demo/masked-input.js