hi. I want to code a 'preview' function into a guestbook entry page. I can
do it with a button that posts, bringing up a whole new page showing a
preview of what has been entered, and then the user could hit a 'return to
entry form' button or some-such and go back to the form.
But what I want to do instead is just use 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. The user can just close this window and he's right where he was on
the guestbook entry form.
For the 'Preview' link i have:
<a href="#"
onClick="popawi ndow(500,400,'p reviewgbmsg.php ?t='+window.doc ument.signupfor m
..message.value );return false;">Preview </a>
Note that 'popawindow' is just a javascript program that opens another
browser window (of size 500x400), using the 'previewgbmsg.p hp' 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. grrrr
I know that in pure javascript, if i do:
Alert(window.do cument.signupfo rm.message.valu e);
i will see all hard returns in the alert window. So one would THINK that the
object value expression SHOULD be returning hard returns in some way (i
haven't a clue how) in my t='+window.doc. .ect 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?
thanks,
-dg
do it with a button that posts, bringing up a whole new page showing a
preview of what has been entered, and then the user could hit a 'return to
entry form' button or some-such and go back to the form.
But what I want to do instead is just use 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. The user can just close this window and he's right where he was on
the guestbook entry form.
For the 'Preview' link i have:
<a href="#"
onClick="popawi ndow(500,400,'p reviewgbmsg.php ?t='+window.doc ument.signupfor m
..message.value );return false;">Preview </a>
Note that 'popawindow' is just a javascript program that opens another
browser window (of size 500x400), using the 'previewgbmsg.p hp' 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. grrrr
I know that in pure javascript, if i do:
Alert(window.do cument.signupfo rm.message.valu e);
i will see all hard returns in the alert window. So one would THINK that the
object value expression SHOULD be returning hard returns in some way (i
haven't a clue how) in my t='+window.doc. .ect 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?
thanks,
-dg
Comment