Closed CarlosBonetti closed 8 years ago
The only behaviour that's currently being tested is creating a new mask with the raw value of an old mask, which is ultimately testing what Pattern.prototype.formatValue()
does with it, rather than the actual raw value itself.
We'd need to have a look at what the use cases we want to support are to decide exactly how the raw value should work - the primary use case for raw values was to support changing the masking pattern without completely blowing away the user input, but the test for that is very basic at the moment.
Other questions:
___.123.___-__
or islands of input123.___456-__
- you can currently do these by selecting and deleting some of your input.
I see. What I needed was a way to get only the characters sent by the user, discarding gaps. But considering the user can move around, like in the ___.123.___-__
example, I could see both 123
and [3 spaces]123[5 spaces]
being returned depending the use case. Returning spaces instead of placeholder is particularly useful so we maintain the input gaps and IMO makes more sense than returning the placeholder char just to preserve the gaps.
But again, it depends the application use case, maybe creating a different function like getEnteredValue
or getTypedValue
to return 123
and preserve the getRawValue
behaviour (maybe changing placholder char by space)...
I'm closing this since it's a very specific use case which I managed to implement in other ways. Thanks!
This is still a relevant use-case for me. I would like something like getRealValue
and getUserValue
:
It could behave like this for example:
Mask: 1111 1111 1111 1111
Placeholder: ____ ____ ____ ____
getRealValue: 1234
getUserValue 1234
getRealValue: 1234 5678
getUserValue 12345678
getRealValue: 1234 5678 1234
getUserValue 123456781234
getRealValue: 1234 5678 1234 1234
getUserValue 1234567812341234
Mask: 1111/WWWW/1111/WWWW
Placeholder: / / /
getRealValue: 1234
getUserValue: 1234
getRealValue: 1234/ABCD
getUserValue: 1234ABCD
getRealValue: 1234/ABCD/1234
getUserValue: 1234ABCD1234
getRealValue: 1234/ABCD/1234/ABCD
getUserValue: 1234ABCD1234ABCD
Is this something that would fit the project?
Hi @insin ! Thanks for this project!
Just a question. The documentartion for
getRawValue()
says: "Gets the current value in the mask without non-editable pattern characters." This includes the placeholderChar right?Right now, if I do:
Is this the expected behaviour? It's not the one I expected... I could work on some solution and tests buy I wanted to know if this is wanted... Thanks!