Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum length of html textbox

Tags:

html

asp.net

can anyone help me with the length of maximum characters that can be contain in a normal HTML text box....

like image 630
deepu Avatar asked Oct 19 '10 14:10

deepu


People also ask

What is the max length of textbox?

The default value is 32767 .

What is the maximum length of values in HTML?

Microsoft Excel has a character limit of 32,767 characters in each cell.

How do you set the minimum and maximum length of a textbox in HTML?

You can specify a minimum length (in characters) for the entered value using the minlength attribute; similarly, use maxlength to set the maximum length of the entered value, in characters. The example below requires that the entered value be 4–8 characters in length.


3 Answers

Default maxlength is unlimited for a <input type='text'/>. You may optionally provide this value to constrain input (but there's no guarantees the browser will enforce the rule).

A <textarea> does not support a maxlength so unlimited characters are accepted for input.

(ref: https://www.w3.org/MarkUp/HTMLPlus/htmlplus_41.html)

RE: Long string breaking during submit

There can be a maximum size to the amount of data submitted from a form when using the method get (the default if not specified). It's only a can because many browsers allow many more characters now. If you use a form with the post method, there is no maximum to the amount of data submitted.

like image 68
Rudu Avatar answered Oct 12 '22 22:10

Rudu


As to the HTML side, when the maxlength attribute is not specified, then the maximum length of the input value is unlimited. However, if you're sending the request as GET instead of POST, then the limit will depend on the webbrowser and webserver used. The HTTP 1.1 specification even warns about this, here's an extract of chapter 3.2.1:

Note: Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.

As to the webbrowsers, the practical limit is in Firefox about 8KB, in Opera about 4KB and in IE and Safari about 2KB. So the total length of all inputs should not exceed this if you want a succesful processing. As to the webservers, most have a configureable limit of 8KB. When the limit is exceeded, then it will often just be truncated, but some webservers may send a HTTP 414 error.

When you're sending the request as POST, then the limit depends on the server config. Often it's around 2GB. When it's exceeded, the server will often return a HTTP 500 error.

like image 29
BalusC Avatar answered Oct 13 '22 00:10

BalusC


In HTML4, the maxlength attribute is only supported on the input element. HTML5 extends this to allow it on textarea as well. A quick test works in Firefox 4 and WebKit, but not Firefox 3 or Opera. If you need support for HTML4, use JavaScript to manually limit the length.

like image 37
Josh Lee Avatar answered Oct 12 '22 22:10

Josh Lee