NYCPHP Meetup

NYPHP.org

[nycphp-talk] length of form element names?

Mikko Rantalainen mikko.rantalainen at peda.net
Wed Oct 12 04:43:02 EDT 2005


Andrew Yochum wrote:
> On Tue, Oct 11, 2005 at 02:42:50AM -0400, Marc Antony Vose wrote:
> 
>>How long can the name of a form element be?  Is there a limit?
> 
> I can't say I've run into a limit, nor do I know of one on the _name_ of
> a form element.   But there are limits to the length of URLs.  I believe
> the documented limit is 1024 chars, but most browsers will do much more.
> Anyway, my point is if you have lots of long form element names in one
> form, don't use a GET for sure!  Use a POST.

I googled for "rfc url length" and got RFC 2397 as an answer 
(http://www.faqs.org/rfcs/rfc2397.html). It says that HTML 2.0 has 
following limits:

maximum length of literal attribute value (for href of a or action 
of post or value of input type hidden) is 1024 bytes (LITLEN)

maximum combined length of all attribute values of a single tag is 
2100 bytes (ATTSPLEN)

maximum length for a single tag in source code is 2100 bytes (TAGLEN)

[as a side note, limit of 2100 bytes for a tag limits maximum 
combined attribute length to less than 2100 bytes in real life.]

**

Fortunately, no current user agent has such a low limits. HTML 4.01 
says (http://www.w3.org/TR/html401/conform.html#conformance):

"A user agent should avoid imposing arbitrary length limits on 
attribute value literals (see the section on capacities in the SGML 
Declaration). For introductory information on SGML attributes, 
please consult the section on attribute definitions."

HTML 4.01 SGML Declaration 
(http://www.w3.org/TR/html401/sgml/sgmldecl.html#h-20.1) has 
following part:

   ATTCNT   60      -- increased --
   ATTSPLEN 65536   -- These are the largest values --
   LITLEN   65536   -- permitted in the declaration --
   NAMELEN  65536   -- Avoid fixed limits in actual --
   TAGLEN   65536

and the declaration includes a message that says
"These are the largest values permitted in the declaration. Avoid 
fixed limits in actual implementations of HTML UA's."

RFC 2616 doesn't set any limits for the lenght of URL.

As for the real world limits,

"Internet Explorer has a maximum uniform resource locator (URL) 
length of 2,083 characters [...] If you are using the GET method, 
you are limited to a maximum of 2,048 characters (minus the number 
of characters in the actual path, of course)." 
(http://support.microsoft.com/default.aspx?scid=KB;en-us;q208427).

-- 
Mikko



More information about the talk mailing list