D
dan glenn
hi. I'm having a problem using javasript to pass the value of a textarea (in
a form) to a PHP script file.
I want to code a 'preview' function into a guestbook entry page, using an
HTML link with some javascript to grab the form's textarea value, and open
another browser window that uses a php file that applies all the styles,
etc. to the contents of what was in the text area (the guestbook entries
allow simple HTML) and show the preview that way.
For the 'Preview' link i have:
<a href="#" onClick="popawindow(500,400,'previewgbmsg.php?t='
+window.document.signupform.message.value);return false;">Preview</a>
Note that 'popawindow' is just a javascript program I use that opens another
browser window (of size 500x400 here), using the 'previewgbmsg.php' PHP
file, with the GET argument that is passing the textarea's value text to the
PHP file to process.
Now, all this works just fine, EXCEPT that the hard returns in the textarea
are not coming over.
I know that in pure javascript, if i do:
Alert(window.document.signupform.message.value);
i will see all hard returns that may have been in the textarea in the alert
message window. So one would THINK that the object value expression SHOULD
be returning hard returns, at least in some way (i haven't a clue how) in my
t='+window.doc...etc expression.
Anyway, I'm not getting them. I get everything else. (Makes no difference
the WRAP setting in the Textarea tag, by the way). Is there a way I can pass
a <Textarea>'s current value to a PHP script file, included any hard returns
it may have? Is there some way I can "pre-process" the textarea value so I
can put it into the 'get' for my php file?
thanks,
-dg
a form) to a PHP script file.
I want to code a 'preview' function into a guestbook entry page, using an
HTML link with some javascript to grab the form's textarea value, and open
another browser window that uses a php file that applies all the styles,
etc. to the contents of what was in the text area (the guestbook entries
allow simple HTML) and show the preview that way.
For the 'Preview' link i have:
<a href="#" onClick="popawindow(500,400,'previewgbmsg.php?t='
+window.document.signupform.message.value);return false;">Preview</a>
Note that 'popawindow' is just a javascript program I use that opens another
browser window (of size 500x400 here), using the 'previewgbmsg.php' PHP
file, with the GET argument that is passing the textarea's value text to the
PHP file to process.
Now, all this works just fine, EXCEPT that the hard returns in the textarea
are not coming over.
I know that in pure javascript, if i do:
Alert(window.document.signupform.message.value);
i will see all hard returns that may have been in the textarea in the alert
message window. So one would THINK that the object value expression SHOULD
be returning hard returns, at least in some way (i haven't a clue how) in my
t='+window.doc...etc expression.
Anyway, I'm not getting them. I get everything else. (Makes no difference
the WRAP setting in the Textarea tag, by the way). Is there a way I can pass
a <Textarea>'s current value to a PHP script file, included any hard returns
it may have? Is there some way I can "pre-process" the textarea value so I
can put it into the 'get' for my php file?
thanks,
-dg