Viewing 5 reply threads
  • Author
    Posts
    • #1281

      I have set up a nice set of Workflow tabs that require the user to go through them one by one. The issue that I am having is that the data in a field is lost when the user clicks the next tab and the page reloads.

      Anyone know of a way to maintain the data in each field when a workflow tab is clicked? or is there a good way to ask the user to update the post before clicking a new tab and/or popping up a dialogue box to remind them to save that field set before moving on?

      This may have to be done via some AJAX.

      Thanks!

    • #1283
      Marcus
      Member

      Two suggestions:
      1. Use the post hooks in piklist to move your user to the next tab AFTER they publish or save their work.
      2. Use transients, and hook into the post hooks of piklist.

      As they post/publish (actually save) their work, the tabs could then load automatically to the next tab, and you could keep the previous work by keeping it in transients, or even better, once they post, its just kept in the post_meta tables and you can retrieve it as you need too.

      Just a thought.

      Marcus

    • #1290

      Thanks so much for the reply Marcus.

      I think what I will try for now is just to add a “Save” button to the bottom of each workflow page. That way at a draft will be saved.

      It would be great if a pop up dialog would come up if a user clicks on a new tab and has not saved their work on the current page.

      Ideally I would like the post to save automatically as a draft each time a workflow button is clicked and I’ll continue to look into it.

      One thing I have noticed is that if the user doesn’t save/publish the post before clicking another workflow tab then a new auto-draft of the post is entered into the database which can cause some bloat.

      Cheers,
      John.

    • #1291
      Marcus
      Member

      If you’re going to use an alert. I’d set a JavaScript var in each of your piklist metaboxes that states what step your in. Then use a simple if statement to determine if they should go to the next tab not. (Capturing the click event for when they click on a tab)

    • #1292
      Marcus
      Member

      Just wanted to update this, now that I have a keyboard and not a phone keyboard to write this.

      In any metabox (or any piklist part) you can add HTML.

      So

      ?>
      <script>
      var currentstep=1;
      </script>
      <?php
      

      Would setup a var for that metabox. (or tab)

      Then you can just setup a simple javascript check in the same metabox if you wanted to check against the current step:

      ?>
      <script>
      jQuery(".metabox-holder h2 a.nav-tab").click(function (e) {
      e.preventDefault();
      e.stopPropagation();
      if (currentstep==1 && jQuery(this).attr('href').indexOf('&flow_page=nextsteptabname')) { 
      alert('please save the tab you are on currently before moving on');
      return false;
      }
      });
      </script>
      <?php
      

      Tada, simple step checking. (obviously you can get a lot more detailed, but its all very easy using piklist)

      Marcus

    • #1293
      chan
      Member

      Thanks Marcus. Great idea. I’ll have to try this out.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.