You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way we can restrict users from entering more numbers than defined?
Use case:
I want to input ID CARD NUMBER. And it's a 6 digit only CODE. ex. 223344. Not 22334455. ← Don't allow this.
I don't want to use inputMask as it shows the ___ underscores. I just want plain simple number input where user can type only 6 digit / char long number. not more than that.
<template>
<ThemeSwitcher />
<div class="card flex flex-wrap gap-4">
<div class="flex-auto">
<label for="minmax" class="font-bold block mb-2">
User can enter Max 5 digits.
</label>
<InputNumber
v-model="value4"
inputId="minmax"
:min="0"
:max="5"
:useGrouping="false"
fluid
/>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
const value4 = ref(50);
</script>
@HarshilPatel007 according to the API for InputNumber, you could simply set a min and max boundaries, for example if your ID needs 6 digits, The smallest 6-digit number is: 100000 and The largest 6-digit number is: 999999. I guess this way you could achieve what you are expecting.
Describe the bug
hello guys,
Is there any way we can restrict users from entering more numbers than defined?
Use case:
I want to input ID CARD NUMBER. And it's a 6 digit only CODE. ex. 223344. Not 22334455. ← Don't allow this.
I don't want to use inputMask as it shows the
___
underscores. I just want plain simple number input where user can type only 6 digit / char long number. not more than that.Pull Request Link
No response
Reason for not contributing a PR
Other Reason
No response
Reproducer
https://stackblitz.com/edit/fzh8fs51?file=src%2FApp.vue
Environment
deps.
dev deps.
Vue version
^3.5.13
PrimeVue version
^4.3.3
Node version
No response
Browser(s)
No response
Steps to reproduce the behavior
type in input field.
Expected behavior
It should not allow users to type more than 6 digits / chars
The text was updated successfully, but these errors were encountered: