Michael Paulukonis
Michael Paulukonis

Reputation: 9100

What is the max-length of the value for an HTML input form (in InternetExplorer)

I haven't been able to find this anywhere, either because it is undefined, a silly question for some reason I will discover shortly, or because I'm using the wrong terms.

What is the maximum amount of data I can put into an HTML form input field? Specifically for IE 7,8 and 9 (if that matters).

I'm converting an application that previously passed information through the querystring, and IE has a max-length of around 2048 for the URL, so that method has serious data-limitations that the client ran into.

I read (don't have citation) that form-posts for IE can contain up to 70K of information, so this seems much more reasonable. But I want to make sure I'm not running up against limitations. This is a dynamically created form, if that makes a difference.

Previously, the app was only sending documentIDs; now I'm sending a whole mess of data via JSON.stringify in a form-field (if this is a dumb idea, I'm sure you'll point it out).

It's targeting a hidden iFrame because the server returns a .csv file that the user should be prompted to download, and IE will only do this from an iFrame (there are no other browsers used, and the app is running under IIS6).

var post_to_url = function (path, params, method) {
    method = method || "post"; // Set method to post by default, if not specified.

    var form = document.createElement("form");
    form.setAttribute("method", method);
    form.setAttribute("action", path);
    form.setAttribute("target", "appFrame");

    var hiddenField = document.createElement("input");
    hiddenField.setAttribute("type", "hidden");
    hiddenField.setAttribute("name", "data");
    hiddenField.setAttribute("value", JSON.stringify(params));

    form.appendChild(hiddenField);

    document.body.appendChild(form);
    form.submit();
};

Upvotes: 0

Views: 697

Answers (1)

Yuriy Galanter
Yuriy Galanter

Reputation: 39817

This is rather controlled by server side. Since you're using ASP.NET it's maxRequestLength element of Web.Config

http://msdn.microsoft.com/en-us/library/e1f13641(v=vs.90).aspx

Upvotes: 1

Related Questions