I'm trying to input a textarea tag when I submit my form:
<textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText" form="confirmationForm"></textarea>
<form action="sendConfirmation.php" name="confirmationForm" method="post">
<input type="submit" value="Email" class="submitButton">
</form>
As you can see I've set the form="confirmationForm" attribute in my textarea tag. I've used Live HTTP Headers to catch the POST request and it is empty (so I know the problem is not in sendConfirmation.php, the problem is that the confirmationText is not being POSTed). I've searched the net and as far as I can see I've set it correctly.
try to put it inside the form tag as follows... it should work
<form action="sendConfirmation.php" name="confirmationForm" method="post">
<textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText"></textarea>
<input type="submit" value="Email" class="submitButton">
</form>
however you can use the same approach as well but you need to provide the from id attribute then
<form action="sendConfirmation.php" id="confirmationForm" method="post">
<input type="submit" value="Email" class="submitButton">
</form>
You must put in the form attribute of the textarea the form's id, not it's name.
try:
<textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText" form="confirmationForm"></textarea>
<form action="sendConfirmation.php" id="confirmationForm" name="confirmationForm" method="post">
<input type="submit" value="Email" class="submitButton">
</form>
You need to put your textarea inside the form tag
<form action="sendConfirmation.php" name="confirmationForm" method="post">
<textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText" form="confirmationForm"></textarea>
<input type="submit" value="Email" class="submitButton">
</form>
When a form is submitted everything inside it is sent, any inputs outside the form tag are ignored.
Just Add Form="formId" attribute to TextArea tag and Assign Id to Form
<textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText" form="confirmationForm"></textarea>
<form action="sendConfirmation.php" id="confirmationForm" name="confirmationForm" method="post">
<input type="submit" value="Email" class="submitButton">
</form>
I was having the same issue, got it resolved by adding method="post" in textarea.
Make sure you are not missing out on name attribute of textarea tag. This happend to me in django.
<form action="sendConfirmation.php" name="confirmationForm" method="post">
<textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText" form="confirmationForm"></textarea>
<input type="submit" value="Email" class="submitButton">
</form>
<form action="sendConfirmation.php" name="confirmationForm" method="post" id="confirmationForm">
you need to add id in the form tag
textarea form="confirmationForm" match form id="confirmationForm"
try it
Bit of a necro here but it's still high in the Google search rankings, so adding my 2 cents -- what finally worked for me was NOT using the form= attribute if the textarea is inside the form. Even though the name was the same as the form's name, it didn't work until I removed the form= bit. Tried defaultValue, tried putting some text in the textarea itself, none of those helped.
Try to put it beside the form tag as follows... It should work.
<form action="sendConfirmation.php" name="confirmationForm" method="post">
<textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText" form="confirmationForm"></textarea>
<input type="submit" value="Email" class="submitButton">
</form>
来源:https://stackoverflow.com/questions/18816735/textarea-not-posting-with-form