Remove form page from history

Hi All,

My application will navigate to form page like below
index (page1) -> list (page2) -> particular form page based on previous selection then form submit (page3) -> list (page2)

On submission of page3, app will navigate to page2. While clicking back button in page2 it should navigate to page1 instead of page3.

I tried app.views.main.history.pop(); also. But still its navigating to page3 only.

Anyone had same scenario?

1 Like

Hi @nolimits4web,

Can you help to achieve this ?

It is possible by:

  1. modifying view history array
  2. you need to reflect DOM pages with view history. So you may need to remove previous pages from DOM by yourself.

Another option is using force on page2 back button, e.g. <a href="/page1/" data-force="true">Back to page 1</a> should do the trick as well

Hi @nolimits4web,

The second option won’t work in my case, because its dynamic multiple view.

I tried the first option by adding below scripts in page2.

pageAfterIn: function() {
        var app = this.$app;
        for (var i = 0; i < app.view.main.history.length; i++) {
            if (app.view.main.history[i] === '/page3/'){
                  //app.view.main.history.splice(i,1);
                  app.view.main.history.pop();
                  $('.page-previous, .navbar-previous').remove();
           }
        }
 }

This one working fine for page2 ==> dynamic view2 to dynamic view1
But page2 (dynamic view1) to page1 is not working.

Flow: page1 -> page2:view1 -> page2:view2 -> page3
Working flow with above query : page3 -> page2:view2 -> page2:view1 (after this page1 unable to reach)

Can you setup a JSFiddle showing your issue so I can take a look?

You can use this one to start from https://jsfiddle.net/nolimits4web/o2ejupu1/