-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MudTextField - Using ***InputType="InputType.Number"*** and ***MaxLength="6"*** does not prevent the entry of too many characters #9359
Comments
Appears to be a limitation with the Conditionally adding MudBlazor/src/MudBlazor/Components/Input/MudInput.razor Lines 57 to 81 in 84e3b88
Are you able to use the NumericField instead? |
An InputType of InputType.Number does not respect maxlength. You will have to change that and it will work. Right now it's rendering as type="number" which ignores the maxlength since it's expecting a number. That's why you can't put text into the field. Alternatives:
|
Bug type
Component
Component name
MudTextField
What happened?
if you set "InputType="InputType.Number" and the MaxLength="6" wont working. I think this is undesirable behavior, at least I think so.
Expected behavior
Regardless of the InputType, setting MaxLength should prevent the user from entering any more characters.
Reproduction link
https://try.mudblazor.com/snippet/waQeaLODLyIMiUTB
Reproduction steps
Add the the following Component to a razor page:
Why is this Important for me:
I need a Input-Field that only shows the number-keyboard on mobile and get me a string that only contain numbers.
Relevant log output
No response
Version (bug)
6.20
Version (working)
No response
What browsers are you seeing the problem on?
Chrome
On which operating systems are you experiencing the issue?
Windows
Pull Request
Code of Conduct
The text was updated successfully, but these errors were encountered: