Maximum value of input

Asked

Viewed 462 times

1

My doubt is the following, I would like to know what is the maximum of characters that a tag input text supports, I thank you already for the attention.

2 answers

3


I couldn’t find anything to talk about maximum number of characters in a input[type='text'] on the website HTML LS - Last Updated 8 July 2019, until the moment what I found was:

MDN web Docs says:

Attr: maxlength
The Maximum number of characters (as UTF-16 code Units) the user can enter into the text input. This must be an integer value 0 or Higher. If no maxlength is specified, or an invalid value is specified, the text input has no Maximum length. This value must also be Greater than or Equal to the value of minlength.

That translated would be something like:
If the attribute maxlength is not set or has an invalid value the input text has no maximum size.

Already the W3schools says:

Attr: maxlength
The Maximum number of characters allowed in the element. Default value is 524288

i.e., it says that the default value of the attribute maxlength is 524288.

Looking at this information, there is no guarantee that the input['text'] is unlimited and even if the maximum is 524288, I would use as a basis the value that W3schools says is the standard.


Anderson Carlos Woss: "Just commenting, it was expected that the specifications would not define this because it is a limitation of implementation, not specification. The browser (or any client) will have to store this value internally in some way, so the limit is most associated with how each browser was developed and what are the hardware limitations on which it is running. It is possible that each browser sets a limit and it would not be strange if they were different limits."

  • 2

    Just commenting, it was expected that the specifications would not define this because it is a limitation of implementation, not specification. The browser (or any client) will have to store this value internally in some way, so the limit is more associated with how each browser was developed and what are the limitations of hardware where it is running. It is possible that each browser sets a limit and it would not be strange if they were different limits.

  • 1

    @Andersoncarloswoss great review, likely to be so.

  • @Andersoncarloswoss really -- I will put a quote from your comment in the answer I found it very important for the question.

1

The default value is 524288 characters. Which in my opinion is a choice that limits the implementation, because the value could be stored somewhere like the storage or database, but this value is a choice to limit the input of 512 KB.

Currently this value of KB is dependent on the particular browser, for example: The developers of Chrome found a performance problem with texts longer than that and then they tightened the maxLength and apparently they forgot it after.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.