Cannot enter the fourth zero with mask '#:0:0:###'
What happened?
The fourth zero disappears
What did you expect to happen?
0:0:0:0 in the q-input as a value
Reproduction URL
https://codepen.io/doox911/pen/PwwzGgr?editors=101
How to reproduce?
- Enter zero
- Enter zero
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
SPA Mode
Platforms/Browsers
Other
Quasar info output
Relevant log output
Additional context
No response
Problem is more complex. The reason is the suppression of input characters from mask. With mask="1###" you can't enter number with 1
Numbers are not supported tokens in the mask: https://quasar.dev/vue-components/input#mask .
You probably want to have some regex based manual validation.
Numbers are not supported tokens in the mask: https://quasar.dev/vue-components/input#mask .
You probably want to have some regex based manual validation.
The documentation specifically states that it is supported. The '#' symbol is used.
https://github.com/quasarframework/quasar/blob/dev/ui/src/components/input/use-mask.js#L6
Numbers are not supported tokens in the mask: https://quasar.dev/vue-components/input#mask . You probably want to have some regex based manual validation.
The documentation specifically states that it is supported. The '#' symbol is used.
https://github.com/quasarframework/quasar/blob/dev/ui/src/components/input/use-mask.js#L6
I mean numbers like '0', '1', '2' etc. ### works fine, 1## does not.
Numbers are not supported tokens in the mask: https://quasar.dev/vue-components/input#mask . You probably want to have some regex based manual validation.
The documentation specifically states that it is supported. The '#' symbol is used. https://github.com/quasarframework/quasar/blob/dev/ui/src/components/input/use-mask.js#L6
I mean numbers like '0', '1', '2' etc.
###works fine,1##does not.
I don't quite understand you. In my case, it's not 1##, but rather 1:##. Could you please elaborate in more detail on what you mean?
It does work a little different than I thought. You can only use the input with the supported mask tokens
With 1:## you can only enter two numeric characters. With 1:0:0:0 you can't enter anything as there are no mask tokens.
It does work a little different than I thought. You can only use the input with the supported mask tokens
With 1:## you can only enter two numeric characters. With 1:0:0:0 you can't enter anything as there are no mask tokens.
Well, that's clear enough! My problem is that with the mask 0:#, I can't input 0 in place of the # symbol.
@doox911 I had a look at this. This is caused because of this line in use-mask.js.
I believe in this case the comparison here is wrong.
if (typeof maskDef === 'string') {
output += maskDef
valChar === maskDef && valIndex++
}
It wrongly consumes the input value (i.e. increments valIndex) just because the literal happens to match the next typed char (like '0').
Maybe this is done willingly for other more complex/predefined cases. Otherwise it's a bug and this line can safely be removed. This line too I suppose for the reverse mask.