jondavidjohn / payform

:credit_card: A library for building credit card forms, validating inputs, and formatting numbers.
https://jondavidjohn.github.io/payform/
Other
427 stars 81 forks source link

How to pre-fill the input value? #31

Closed slavafomin closed 6 years ago

slavafomin commented 6 years ago

Is there a way to pre-fill the input value and make the value properly formatted?

Thank you!

slavafomin commented 6 years ago

The workaround I use is to manually trigger the input event on the input field like this:

inputElement.dispatchEvent(new CustomEvent('input', {}));

jondavidjohn commented 6 years ago

This isn't a use case I've considered as most of the time you're not dealing with known card numbers (due to PCI compliance issues), glad you found a workaround!