0

I am using a jQuery plugin called Stepy, to allow users to complete a 10-step form.

Sample form: http://jsfiddle.net/wvkfn/

My site is setup so the user can leave the form in the middle of a 'step', in order to complete other tasks, and I'd like to have a variable set, so that when they complete the task, it takes them back to the last step they were on.

Is there a way to pull the value of the 'current' step from the plugin? My first thought was that the plugin places a class called current-step on the title, and pull the number value from the title text that has that class set.

I'd then want to set that as a PHP variable, so I could set the task link to something like http://www.example.com/task.php?step=3.

Any ideas on how to go about this?

2 Answers 2

1

Use the 'select' option stepy offers to register a callback when a tab is selected. In the callback use an asynchronous POST to your server to store the currently selected tab.

Sample:

$('#custom').stepy({
    ...,
    select: function(index){
        $.ajax({
            url: "saveCurrentStep?userID=1&step=" + index;
        });
    }
});
Sign up to request clarification or add additional context in comments.

Comments

0

The simple solution would be to store a cookie for current step OR you can use anchors for each step like for step 1 mysite.com/task.php#tsep1 and pull the value from URL

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.