View Full Version : What is the best way to forward Textarea data?
03-21-2004, 06:29 PM
What is the best/simplest way to forward textarea data so that if on page1.html there is a textarea with new data entered in the following format:
when submit is clicked, the data should be sent to a textarea on page2.html
I know how to do this with input areas where data has to be in one line, but with the textarea i want the data to be on seperate links, one under the other - not everything forced into one line.
What is the best/simplest way to implement this?
03-22-2004, 12:02 AM
03-22-2004, 12:20 AM
This is what i used:
<form method="GET" action="page2.html">
<input type=text name=myvar>
<input type=submit value="submit">
startat = window.location.search.length
<input type="text" name="newvar" value=myvar>
document.forms["whatever"].newvar.value = myvar;
Another question, is there a way to force a textarea box to interpret a "\n" as being a breakline as opposed to treating it as normal text?
03-22-2004, 12:30 AM
This question does in fact belong in the php section of these forums. Hopefully a mod will see this and be nice enough to move it for you.
03-22-2004, 12:39 AM
Anyone know whether there is a way to force a textarea box to interpret a "\n" as being a breakline as opposed to treating it as normal text?
03-22-2004, 09:31 AM
You need to unescape the value parsed from URL to get its actual value. If you use textareas in your pages and use your existing code, the text will display newlines as newlines in the textarea.
document.forms["whatever"].newvar.value = unescape(myvar);
There is a better script (http://www.codingforums.com/showthread.php?s=&threadid=25786) that can parse multiple URL querystrings. Your existing code will only work if there is only one 5-letter parameter. In that script, you don't need to unescape the value as the script already does it for you.
03-22-2004, 03:59 PM
That works great :D
One other thing, the method i'm using, if i use two words and they have a space in between - once it gets sent to the textarea in the next page, the words end up having a "+" in between them because the address bar has a "+" in it. Is there anyway to replace "+" with a space instead?
03-23-2004, 02:49 AM
I think the script I linked handles that properly. Are you using that script?
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.