- This topic has 5 replies, 3 voices, and was last updated 8 years, 1 month ago by
chan.
-
AuthorPosts
-
-
December 31, 2013 at 2:53 pm #1281
johnmcalesterMemberI 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!
-
January 1, 2014 at 10:25 pm #1283
MarcusMemberTwo 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
-
January 4, 2014 at 3:43 pm #1290
johnmcalesterMemberThanks 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. -
January 4, 2014 at 7:24 pm #1291
MarcusMemberIf 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)
-
January 4, 2014 at 8:07 pm #1292
MarcusMemberJust 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> <?phpWould 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> <?phpTada, simple step checking. (obviously you can get a lot more detailed, but its all very easy using piklist)
Marcus
-
January 5, 2014 at 11:05 am #1293
chanMemberThanks Marcus. Great idea. I’ll have to try this out.
-
-
AuthorPosts
- You must be logged in to reply to this topic.