6 Replies Latest reply on Jun 18, 2009 8:14 AM by Cap'tn Jack

    save, draft, preview

    Cap'tn Jack

      Hi! I haven't been to this forum for some time and may have neglected to thank all those who have help in the passed so I'll do that now... Thank you all! Now my current problem is I have a form in which everything works well but I would like to be able to offer users the opportunity to either a/. save their input as a draft which they can edit at a later time, b/. preview the input in a page the same as the final product, c/, simply submit and save as normal. I am sure I can accomplish this with radio buttons or checkboxes but I would prefer to offer it by simply choosing one of three buttons I.E. Submit, Save As Draft and Preview.  Can this be accomplished using custom triggers? if so can anyone offer some suggestions and perhaps an example of the PHP code to use.  Any help and guidance in this matter is greatly appreciated.


      Thanks R. Hynds

        • 1. Re: save, draft, preview
          DwFAQ Level 4

          All methods are the same ie save, preview, send they all save info in the database it just depends which button pressed will save which field in table to determine if message is saved, sent or preview. So use insert record SB to insert info in DB with table fields for saved or sent then when you press a button it either adds info in saved or sent table field to determine if the info was saved or sent.

          • 2. Re: save, draft, preview
            Cap'tn Jack Level 1

            Thank you for your input, however I'm a little confused... are you suggesting that I should create different tables for "Preview, Draft and Save"? or put three insert buttons with different values, if the second it true how is the "Preview" data removed from the DB. if the user decides not to publish, also I apologize for my ignorance but I am not sure what "SB" means.


            Thank You

            • 3. Re: save, draft, preview

              I think I did something similar to this, what I did was I got my info for the preview from POST data (or DB) and echoed as a table, but I had hidden forms with the data ready to submit when they clicked my Submit Button, it saved or updated the DB.


              If thats not the issue and you are needing to have one form do several actions, I had conditional regions for my insert and update buttons as well as the insert or add column code. Using either I simply had an identifier  ( like the old DW "MMinsert = "form1"") that let my function know whether my form was updating or inserting.


              The trick is decide where you can "catch" the process in motion and iterupt it with your identifier to validate thats the function you want.


              EX: If i'm using one table for preview, use text to show results, when they click edit, the page witll refresh and you can set a URL attribute "xxx.php?action=edit" then you can set conditional statment to show the next set of buttons that update or insert to the DB.

              *optionally if they click save, you can set a URL attribute "xxx.php?action=save" and have a conditional region to show the insert or update code on the top code portion of the page.


              Thats two ways to set cotrols on the page or in the fuctions lists in the main code, very flexible.


              There are many ways to to control the users flow, set your fuctions/actions, and still have a low click ratio for good usability.


              Good luck,


              • 4. Re: save, draft, preview
                Cap'tn Jack Level 1

                Thank you zzipper7, I have tried your suggestions and I think I'am a little closer but I still can't get it working... when I create the form I place three buttons at the bottom (Save, Save Draft and Preview) code as follows...


                <input type="submit" name''KT_Insert1" id="KT_Insert1" value="Save">

                <input type="submit" name="draft" id="draft" value="Save As Draft">

                <input type="submit" name="prev" id="prev" value="Preview">


                when the form is filled and button one is clicked the data is saved as expected... my problem is the other two buttons... I need to know how to set these buttons... the "Insert Transaction-First check variable is set to Form Variable--KT_Insert1.,. but I see no way to set anything for the other buttons.


                I hope this is clear, thanks in advance for any help.

                • 5. Re: save, draft, preview
                  DwFAQ Level 4
                  I am not sure what "SB" means.



                  "SB" means "server behavior" hope that helps with your development.

                  • 6. Re: save, draft, preview
                    Cap'tn Jack Level 1

                    Doh! I can't believe I missed that, thank you