close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Customise Add Record Form

Thread began 6/09/2011 3:16 pm by A Sound Design | Last modified 6/15/2011 9:36 am by Jason Byrnes | 1989 views | 17 replies |

A Sound Design

Customise Add Record Form

Now that I have a working form that allows me to add a record I'd really like to customise it more. Two things I'd really like are:

  1. An option to save for later - add details but not publish it.
  2. A preview option - a normal Publish button + 1 for previewing the records before going live


So 3 buttons - Save, Preview and Publish

Sign in to reply to this post

Jason ByrnesWebAssist

saving and publishing are really the same thing, for both, you need to save the form information to the database.

in order to distinguish between a saved record and a published record, you would need another column added to the table, lets say for example sake we call this column "status"

you would need to have 2 insert record behaviors on the page, one to trigger off the save button being pressed, in this one, set the status column to 0. the other to trigger off the publish button being pressed in, this one set the status column 1.

for the preview option, you would need to hand code a javascripnt function to use the window.open property to preview the form and trigger this on the onClick event of the preview button.

Sign in to reply to this post

A Sound Design

Ok, not quite got it working. I've added a MySQL field PublishedStatus as Int (11) and added a second submit button. I'm just not quite sure what I need to set in the Insert Record behaviour to give it a value of 1 (or 0). Please see attached file.

Attached Files
dev_add_an_offer.zip
Sign in to reply to this post

Jason ByrnesWebAssist

in the insert behavior to publish, you set that column value to 1, rather than bind it to a form element to get a dynamic value, just type the number 1 for the value.

in the insert behavior to save the record, type the value 0.

Sign in to reply to this post

A Sound Design

I've done that but hitting Publish gives an error - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2011-06-10 07:06:25',1)' at line 1.

Hitting Save just publishes it to the page, ie. live.

Attached Files
dev_add_an_offer (2).zip
Sign in to reply to this post

Jason ByrnesWebAssist

find the folllowing copde on the page;

php:
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());




and change it to:

php:
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error()."<br />".$WA_Sql."");




this will write the full SQL causing the error after the error to help troubleshoot.

Sign in to reply to this post

A Sound Design

Originally Said By: Jason Byrnes
  find the folllowing copde on the page;
php:
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());

and change it to:
php:
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error()."<br />".$WA_Sql."");

this will write the full SQL causing the error after the error to help troubleshoot.  



I did this but it does not give any errors. It just adds the record to the db as before.

Sign in to reply to this post

Jason ByrnesWebAssist

I'm a little confused, in your last post you reported that it was giving you an error:

  I've done that but hitting Publish gives an error - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2011-06-10 07:06:25',1)' at line 1.  
Sign in to reply to this post

A Sound Design

I'm confused too. It was giving that error but not now. It's just not saving the contents of the form for later editing, simply inserting the record into the DB no matter whether you hit save or publish.

Sign in to reply to this post

Jason ByrnesWebAssist

well, yes, both buttons, publish and save will insert the record to the table.

the difference will be the value of the PublishedStatus column, if this column has a value of 1, the article has been published, if it has a value of 0, the articles is only saved.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...