Page 1 of 1

Create a preview button on a form?

Posted: Fri Oct 06, 2006 12:40 pm
by waradmin
I want a popup to appear showing a preview of the data so the user can see how it will be formatted when posted. Then they can just close that window and hit post to actualy send it to the DB, however I cant figure it out for the life of me.

I basicly want to pass the $_POST value for the textarea into a new window so I can echo it onto the popup window, without actualy sending the page to the DB using the submit button.

Current form code:

Code: Select all

<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<center><p><input type="hidden" name="action" value="sign" />
<textarea cols="60" rows="5" name="onwall" style="font-size: 12px; font-family: Georgia;" onKeyDown="limitText(this.form.onwall,this.form.countdown,255);" 
onKeyUp="limitText(this.form.onwall,this.form.countdown,255);"></textarea></p>
<p><font size="1">(Maximum characters: 255)<br>You have <input readonly type="text" name="countdown" size="3" value="255" style="background-color: #d8dfea; color: #000000; border-top: 1px solid #d8dfea; border-left: 1px solid #d8dfea; border-right: 1px solid #d8dfea; border-bottom: 1px solid #d8dfea;"> characters left.</font></p>
<input type="submit" name="submit" value="Post" style="color: #FFFFFF; background-color: #3b5998;"></center>
</form>
I googled the heck out of this, found nothing useful.

Thanks
-Steve

Posted: Fri Oct 06, 2006 12:44 pm
by danharibo
use a Java PoPuP ? to hide URL and use php to send the FOrm values to PHP_SELF with ?Preview=1 to show the preview (Use $_GET )

Posted: Fri Oct 06, 2006 1:45 pm
by RobertGonzalez
Use a button form element with an event handler of onClick to force the form to submit to a new window which handles the form processing.

Posted: Sat Oct 07, 2006 11:48 am
by waradmin
I have tried a few idea's that I found on google concerning onClick events, etc yet none have worked. Can anyone point me in a direction with some helpful information, after atleast 3 hours on this I am still coming up blank.

Thanks in advance.

Posted: Sun Oct 08, 2006 12:34 pm
by Luke
Why don't you just implement a preview function similar to the thread-post preview on these boards?