I want to check whether in v-text-field
the user has entered anything besides digit and show the error directly with the rules
.
The error should also be shown for (+, -, . , ,)
With:
integerValueCheck: [
v => /^\d+$/.test(v) || 'Nur Zahlen erlaubt',
],
the error is also shown when the user has entered something in the text field but has removed it again (empty). Thats not ok. The error should not show then
You must check if value is empty:
integerValueCheck: [
v => !v || /^\d+$/.test(v) || 'Nur Zahlen erlaubt',
]
or
integerValueCheck: [
v => /^\d*$/.test(v) || 'Nur Zahlen erlaubt',
]