Issue metadata
Sign in to add a comment
|
More than 100000 character string gets truncated while submitting the form
Reported by
sata...@gmail.com,
Oct 28 2016
|
||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36 Steps to reproduce the problem: 1. Create simple form 2. add input field and submit button 3. fill input filed with more than 100000 character 4. At server side you will receive truncated string. What is the expected behavior? It should not truncate the string while submitting What went wrong? Browser has truncated the string Did this work before? No Chrome version: 54.0.2840.71 Channel: stable OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version: Shockwave Flash 23.0 r0 Other browsers dosen't truncate the large string while submitting
,
Oct 28 2016
,
Nov 5 2016
Its a post method and input type is hidden.
,
Nov 7 2016
satalaj@, would you provide a reproducible HTML please? I confirmed 110,000 characters were sent successfully to a server with the following code. <!DOCTYPE html> <iframe name=f></iframe> <form method="post" action="https://httpbin.org/post" target=f> <input name=hidden type=hidden id=i> </form> <script> var value = ''; for (var c = 0; c < 110000; c = value.length) { value += String(c) + ', '; } document.querySelector('input').value = value; document.querySelector('form').submit(); </script>
,
Nov 7 2016
The limit encountered wasn't 100,000 characters. It was 524,285 characters. The html is pretty much same as you have provided. Please try something like "c < 600000" in above code.
,
Nov 7 2016
Comment 5, Text fields has 524,288 characters limit. It's Issue 450544 . Type=hidden doesn't have such length limitation.
,
Nov 14 2016
We haven't received enough information to investigate this.
,
Nov 14 2016
You are right, the limit is for text field. In our code, we were not setting the input type=hidden correctly (we were setting the type=hidden after setting the value, which was causing it to be treated like text field.)
Below is the erroneous code.
<!DOCTYPE html>
<input type="button" onclick="sub()" value="submit">
<script>
var sub = function() {
var form = document.createElement("form");
form.name = "hiddenForm";
form.id = "hiddenForm";
form.method = "POST";
form.action = 'http://localhost:56305/home/postdatatest';
form.target = "_blank";
var htmlPostHidden = document.createElement("input");
var value = '';
for (var c = 0; c < 600000; c = value.length) {
value += String(c) + ', ';
}
htmlPostHidden.value = value;
htmlPostHidden.type = "hidden";
htmlPostHidden.name = "data";
htmlPostHidden.id = "data";
form.appendChild(htmlPostHidden);
document.body.appendChild(form);
form.submit();
var child = document.getElementById("hiddenForm");
child.parentNode.removeChild(child);
};
</script>
,
Nov 14 2016
I'm not sure relationship between satalaj@ and vharishchandre@. Anyway, in Comment 8 code, swapping 'htmlPostHidden.value = value;' and |htmlPostHidden.type = "hidden";| would solve the problem.
,
Nov 14 2016
yes, thanks for investigating me and vharishchandre@ are colleague. |
|||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||
Comment 1 by tkent@chromium.org
, Oct 28 2016Labels: Needs-Feedback