Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best Way to preview a post

Status
Not open for further replies.

bluesauceuk

Programmer
Jan 1, 2001
73
GB
Hi

Does anyone know the best way to preview a post before it is added into the database - or becomes live?

Just like the way that this site uses...

Previewing the post in a new window then being able to edit it before you actually publish it?

I am posting a news item - that includes uploaded pictures...

Can anyone help?

Mark
 
Since you use pictures too (and you want your users to be able to preview the full document, including pictures) I suggest you do the following:

1. save the data in the database in preview.cfm; then recapture the ID for the record you have added:

<cfquery name=&quot;GetMax&quot; datasource=&quot;#DSN#&quot;>
SELECT MAX(Id) As LastAdded
FROM Table
</cfquery>

Set this variable as a session variable (Session.Id), you'll need it later.
Upload the picture and show the page the user has made.

2. Have three buttons on preview.cfm: &quot;Save&quot;, &quot;Edit&quot; and &quot;Delete&quot;.

- When user clicks &quot;Save&quot;, you should have a boolean in your DB that'ts called &quot;Publish&quot;, and set this to &quot;Yes&quot; (default is &quot;No&quot;). Now the data has been really saved.

- When user clicks &quot;Edit&quot;, return to your editing page, where you will get the data entered by running a query on your table with Session.Id. The user can continue where he left off.

- When user clicks delete, run a DELETE FROM Table WHERE ID=#Session.ID# query on the table.

Hope this helps...




<webguru>iqof188</webguru>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top