Page 1 of 1

preview and submit

Posted: Sun Sep 25, 2005 4:05 am
by s.dot
I'm making a 'CSS generator'

I have it all done, clicking on the 'Generate Code' button, loads the code into an iframe. Awesome!

But before they generate their code, I'd like them to be able to press a 'Preview' button, which will open a small popup window that shows them the effect of their CSS code, so they can change their settings if they like.

I don't know how to send the $_POST data from the form to this preview page, and still have the Submit (generate code) button there.

Would this require two forms?

Posted: Sun Sep 25, 2005 4:15 am
by AndrewBacca
you could set the submit button to say "preview"
send the action setting to the preview.php
and have the code for previewing it on that page and then have another hidden form with the settings from the form before in and another submit button which goes to a save page

Just an idea but that is what I do when I am checking data sent from forms so it should work :)

Posted: Sun Sep 25, 2005 4:22 am
by s.dot
well i wouldn't like to redirect to a preview page, it'd just like to have it open in a popup.

I could do the if($action=="preview") thing..

but I would either have to send the post data to the $action="preview" or $action="generate"

how does this forum do the preview thing before you submit the data?

Posted: Sun Sep 25, 2005 4:24 am
by AndrewBacca
If I'm not misstaken its simliar to what I descriped but I may be wrong!

Posted: Sun Sep 25, 2005 7:45 am
by feyd
Preview on most forums is done via submission to the server so it can process the data correctly to give you accurate data back.

If you want to use a popup like device, I'd suggest using a floating div and XMLHTTP transport, as that will play nicely with popup blockers, since it isn't one, and probably feel pretty neat from a user experience perspective.