Is it possible to store a different value in the model than is displayed on the input using plugins? #911
Replies: 2 comments 1 reply
-
It is possible yes — actually making a custom input or a plugin that has a different displayed value is rather trivial. However this can get tricky. For example, lets say that your plugin is as simple as taking any text and making it uppercase. So someone types:
Your input stores that as the value, <input @input="e => node.input(e.target.value)" :value="node._value.toUpperCase()" /> Great, now the displayed value is |
Beta Was this translation helpful? Give feedback.
-
@markusgeert We have recently released a new Currency pro input which you can check out here: https://formkit.com/inputs/currency |
Beta Was this translation helpful? Give feedback.
-
I'm trying to build a currency input which automatically formats the value the user enters (adding thousands separators mainly). I want to store the value resulting from this input as a number, while still displaying it formatted with comma's.
This is probably possible using a custom component, but it also seems like a good use-case for a plugin since the component itself doesn't have to be modified. Is it possible to get this behavior using plugins?
Beta Was this translation helpful? Give feedback.
All reactions