How can you change the "Back to" link

At the bottom of every page there is a friendly link saying “Back to …”, which takes the user back to the parent page. That’s great in over 90% of cases, however:

  1. Can I set the back button to go back to a different page higher up the hierarchy.
  2. Is it possible to remove it completely - so that one of the submit options has to be clicked.
  3. Is it possible to carry out Rules when the user goes back.

It would also be nice to have the option to go back showing as a button.

I’m sure you can achieve this with a few lines of code in the JS backend.

$(document).on('knack-scene-render.scene_xx', function (event, scene) {
  $("#scene_xx").find(".kn-view.kn-back-link > a").attr("href", "the link you want it to redirect to");
});
$(document).on('knack-scene-render.scene_xx', function (event, scene) {
  $("#scene_xx").find(".kn-view.kn-back-link").hide();
});

What are the kind of rules you want to enable here?

$(document).on('knack-scene-render.scene_xx', function (event, scene) {
  $("#kn-scene_xx").find(".kn-view.kn-back-link").addClass("kn-button is-primary")
});

Replace “scene_xx” with the scene ID you’d like to change if for.

1 Like

Thanks Arjun. I’ve not discovered the JS Backend yet but will take a look!