"Bad Request" submitting form with textarea

S

Sandy Tipper

I have a form with lots of filds and some javastuff going on,
mostly working fine. However, I can't submit if i have a
textarea with a name attribute... het error 400, bad request.
I can manipulate the contents with javascript using the id,
but without name it doesn't send data with a submit.
The page I'm sending it to (test.php) is simply:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Test</title></head>
<body><pre><?
var_dump($_REQUEST);
?></pre></body></html>

The texarea tag that's problematic is:

<textarea id="MsgText" name="MsgBody" rows="20"
cols="65"><?=htmlspecialchars($MsgBody) ?></textarea>

I only get the list of variables if I omit name=MsgBody", but of course I do
not see that field.
What might be wrong? I'm not nming any other element similarly.
 
M

Markus

Sandy said:
I have a form with lots of filds and some javastuff going on,
mostly working fine. However, I can't submit if i have a
textarea with a name attribute... het error 400, bad request.
I can manipulate the contents with javascript using the id,
but without name it doesn't send data with a submit.
The page I'm sending it to (test.php) is simply:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Test</title></head>
<body><pre><?
var_dump($_REQUEST);
?></pre></body></html>

The texarea tag that's problematic is:

<textarea id="MsgText" name="MsgBody" rows="20"
cols="65"><?=htmlspecialchars($MsgBody) ?></textarea>

I only get the list of variables if I omit name=MsgBody", but of course I do
not see that field.
What might be wrong? I'm not nming any other element similarly.
Have you tried different names? I am not familiar with HTTP requests -
maybe "MsgBody" is some kind of reserved word there?
 
G

GArlington

I have a form with lots of filds and some javastuff going on,
mostly working fine. However, I can't submit if i have a
textarea with a name attribute... het error 400, bad request.
I can manipulate the contents with javascript using the id,
but without name it doesn't send data with a submit.
The page I'm sending it to (test.php) is simply:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Test</title></head>
<body><pre><?
var_dump($_REQUEST);
?></pre></body></html>

The texarea tag that's problematic is:

<textarea id="MsgText" name="MsgBody" rows="20"
cols="65"><?=htmlspecialchars($MsgBody) ?></textarea>

I only get the list of variables if I omit name=MsgBody", but of course I do
not see that field.
What might be wrong? I'm not nming any other element similarly.

Look carefully at what is IN your text area, because without that data
it works for me...
 
H

Henry

On Mar 26, 8:29 am, Sandy Tipper wrote:
Look carefully at what is IN your text area, because without
that data it works for me...

You say that but the OP did not include the FORM element (and so no
information on method or encoding) and did not show the rest of the
form (so no information on the bulk of the request (significant if the
method were GET)). You have filled in (or omitted) more than just the
contents of the TEXTAREA.
 
S

Sandy Tipper

Henry said:
You say that but the OP did not include the FORM element (and so no
information on method or encoding) and did not show the rest of the
form (so no information on the bulk of the request (significant if the
method were GET)). You have filled in (or omitted) more than just the
contents of the TEXTAREA.

My apologies for the brevity, but it is a very complex form with
lots of data in hidden fields. I think I found out, but am about to test.
I think I exceeded the max data value for a POST, or at least the max
in a single field. Time to redesign.
I had a couple of complex dynamically generated arrays of text strings,
and rather than reproducing them in the target page, I "serialized" them
and passed them in a hidden field. The clue: when I used substr to truncate
the message body to one character as a test, there was no error.
I'll let you know.
Just to clarify: is there a practical limit to the size of a textarea
object's
value property, as long as you don't try passing it as POAT or GET data?
I can just give it an id, not a name, and on submit break it into
an array of smaller hidden input fields to pass via POST.
 
V

VK

Just to clarify: is there a practical limit to the size of a textarea
object's
value property, as long as you don't try passing it as POAT or GET data?

Not exactly a form element limit. Gecko has internal limitation for
TEXT_NODE value of 4Kb (4096 bytes). If some node exceeds this value
then the engine splits such nodes on two, three, many internal nodes.
All this supposed to work seamlessly on the background, but exactly
with TEXTAREA Gecko is FUBAR as it sends only the first 4Kb node of
textarea - but at the same time it properly calculates the real
Content-length for POST. As the result your server gets Content-length
header bigger than the physical amount of bytes and if set properly it
reports "bad request". It means two things:
1) don't go over 4Kb for your form elements
2) some ears should be cut off in Mozilla Foundation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top