Input type number and maxlength

Good afternoon,

I have that component

<SfTextBox @bind-Value="ViewModel.ClassFiscal.EX"
                                  Placeholder="EX"
                                  FloatLabelType="FloatLabelType.Auto"
                                  @attributes="HtmlAttributeEX"
                                  Type="Syncfusion.Blazor.Inputs.InputType.Number"
                           >
                </SfTextBox>

 HtmlAttributeEX = new Dictionary<string, object>()
            {
                {"maxlength", "2" }
            };

what I need is to bind a field with string data. But the textbox should accept only numbers. I tryied with a NumericTextBox but it didn't work.
If I use the above configuration, the textbox do accept only numbers but then it doesn't respetc the maxlength. If I take of Type="Syncfusion.Blazor.Inputs.InputType.Number" then it respects the maxlength. How can I fix that?
I also would like to hide the increase/decrease control that appears on the right side of the textbox.

Thank you in advance

1 Reply 1 reply marked as answer

SP Sureshkumar P Syncfusion Team August 26, 2020 07:39 AM UTC

Hi Társis, 
 
Greetings from Syncfusion support.  
 
The maxlength property valid for text, search, url, tel, email, and password, it defines the maximum number of characters (as UTF-16 code units) the user can enter the field. Its not valid for number type. If you want to restrict the number type textbox then please use min and max property. 
 
To know more about maxlength property. please follow the documentation link: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-maxlength  
 
Regards, 
Sureshkumar P 


Marked as answer
Loader.
Up arrow icon