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

  • Home
  • SEARCH
  • 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

Problem I have the following mark-up: <div id=progress-bar> <div id=step-1 class=active><p>1. Select Room</p></div> <div
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'm interested in your advice/opinion on this security problem. I was thinking on doing
I can't figure out what it is going on here...after hours... This is the
My problem is the following: I want to use the idb intel debugger with
Hey all I am having a huge problem here evenafter following every step of
I need to perform following steps: Let user write own code - no problem,
Windows 7 has a wonderful facility called problem steps recorder . You can start

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.