Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Branching wizard with select #11

Closed
xbgmsharp opened this issue Oct 17, 2012 · 4 comments
Closed

Using Branching wizard with select #11

xbgmsharp opened this issue Oct 17, 2012 · 4 comments

Comments

@xbgmsharp
Copy link

Hello,

I am currently writing a wizard, the first question is a select. but I always get the same issue.
[18:31:43.335] Error: [_fastForward]: Invalid step "ofmt" @ jquery.wizard.js:201

I can pass the step if the id of the branch as the same name of the data-state but i don't get the value.

Is this a bug or a i am doing something wrong.
Here is the sample:

                                   <div class="step" data-state="ofmt">
                                            <p>Which color do you like best?</p>
                                            <select name="ofmt">
                                                    <option value="1">pink<option>
                                                    <option value="2">blue<option>
                                            </select>
                                    </div>

                                    <div class="branch" id="1">
                                            <div class="step" data-state="end">
                                                    <p>This is the pink branch.</p>
                                            </div>
                                    </div>
@kflorence
Copy link
Owner

Thanks. I will take a look at this soon. If possible, could you provide the initialization (javascript) code as well?

@xbgmsharp
Copy link
Author

Hello,

Thanks for looking at it.
I did no change the javascript

                    jQuery(function($) {
                            // Example 3: Basic branching wizard
                            $("#example-3").wizard({
                                    transitions: {
                                            color: function( $step, action ) {
                                                    var branch = $step.find("[name=color]:checked").val();

                                                    if (!branch) {
                                                            alert("Please select a value to continue.");
                                                    }

                                                    return branch;
                                            }
                                    }
                            });
                    });

@kflorence
Copy link
Owner

Sorry for the delay, I haven't had time to look at this yet. I'll try to get to it this weekend.

@kflorence
Copy link
Owner

So the problem is that you have a step with: data-state="ofmt" which means, by default (without a matching transition function), the wizard will attempt to navigate to the step (or branch) with id="ofmt" when forward() is called. You can solve this problem in two ways: change data-state="ofmt" to data-state="color" (which will use the "color" transition method to decide where to go next), or you can change the name of the "color" transition function to "ofmt."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants