Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7845907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:24:08+00:00 2026-06-02T17:24:08+00:00

Problem is: When I go to step2. step2 fier well and after it for

  • 0

Problem is: When I go to step2. step2 fier well and after it for some reason “start” route active. How to solve this problem?

the scenario is following. I start from step one -> going to step 2 -> it renders step2view and immediately going to start route again. What is the reason of such behavior?

Short code below.

I have a simple page with minimum markup

<div id="contentHolder">
</div>

And also some backbone stuff

 var StateModel = Backbone.Model.extend({
        defaults: { state: "start" }
    });

    var StepModel = Backbone.Model.extend({
        defaults: { selected: [], location: null }
    });

    var WizardView = Backbone.View.extend({
        router: null,

        nestedViewModels: [],

        initialize: function () {
            this.model.bind("change", this.render, this);
            this.render();
        },

        render: function () {
            switch (this.model.get("state")) {
                case "start":
                case "step1":
                    var step1 = new Step1View({el: $("#contentHolder")});
                    break;
                case "step2":
                    var step2 = new Step2View({el: $("#contentHolder")});
                    break;
                case "step3":
                    var step3 = new UploadView({el: $("#contentHolder")});
                    break;
            }
        }
    });

var Step1View = Backbone.View.extend({
       goToStep2: function(){
         router.navigate("!/step2", true);
       }
    });
    var Step2View = Backbone.View.extend({    
    });

//wizard - is a global variable
var Router = Backbone.Router.extend({

    routes: {
        "": "start",
        "!/step1": "step1",
        "!/step2": "step2"
    },

    start: function () {
        wizard.model.set("state", "start");
    },

    step1: function () {
        wizard.model.set("state", "step1");
    }

    step2: function () {
        wizard.model.set("state", "step2");
    }
});

Only main code listed, much auxiliary code skipped. Be sure – all object assigned. i check it multiple times.

UPD: All next view render to the same place as previous one. And after Step2 renders url change to default for some reason. so instead of url…#!/step2 it change to url…# And i think this is why router fire “start”. But I don’t understand – what things change url.

UPD now it works in the following order:

  1. Step1View.gotoStep2
  2. Router.step2
  3. WizardView.render
  4. Step2View.initialize
  5. Step2View.render
  6. router.start

router.start obviously should not be called

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:24:09+00:00Added an answer on June 2, 2026 at 5:24 pm

    I solve this at last and now dancing victory jig)))
    The problem was coused by my Step2 button. It was a link (anchor) itself, and it has href=”#”. so After I press on it and all scrips works fine it change my url to a.href value. Thats was why default url applied

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my problem step by step, 1- I do ajax get request from
Problem description : - Step 1: Take input FILE_NAME from user at main thread.
Making my first steps in RIA Services (VS2010Beta2) and i encountered this problem: created
I have got a the following problem: I have got multi-step form where in
I followed the steps using this site : http://wiki.apache.org/nutch/RunNutchInEclipse I encountered a problem while
got some problems. Built an applet that has to be used step-by-step. After each
I have multiple input tag submitted from previous page, say step1.php like this :
My problem is like this: I have a tree with root and 4 leafnodes.
I get some doubts about behavior of this code : dispatch_async(queue, ^{ sleep(2); NSLog(@step1);
For some reason, Firefox and Chrome render line-height differently when using text-shadow. CSS: #tracker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.