Limit to 5 digits in textbox
I want to create an input field where the user can only enter digits and it must be 5 digits. I thought the SfMaskedTextbox is the right control to use. It works except I want to eliminate the underscore that shows up at the bottom of the textbox. First of all, is the SfMaskedTextbox the appropriate control or is there a better control? Second, if SfMaskedTextbox is the appropriate control, how do I eliminate the underscore?
|
@using Syncfusion.Blazor.Inputs
<SfNumericTextBox TValue="int?" HtmlAttributes="@htmlattribute"></SfNumericTextBox>
@code{
Dictionary<string, object> htmlattribute = new Dictionary<string, object>()
{
{ "maxlength", "5" },
};
} |
Hi, thanks for this SyncFusion.
It would be useful if the control had a property to support this?
Hi Gene,
Thanks for your update. In SfNumericTextBox component, we have provided support for handling default textbox attributes using the HtmlAttribute property. This will allow you to restrict the input to digits and enforce a 5-digit limit.
- 3 Replies
- 4 Participants
-
GE Gene
- Jan 20, 2022 06:13 PM UTC
- Jul 27, 2023 01:19 PM UTC