Logic Machine Forum
Page ID on change page event - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Page ID on change page event (/showthread.php?tid=2720)



Page ID on change page event - adiaz - 13.07.2020

Hello,

We are trying to add a button that takes the user to previous page.

The link option to 'previous plan' doesn't work like we want..

We are trying with JS but we don't know how to save the ID plan on change plan event.

Is this posible?

Thanks!


RE: Page ID on change page event - admin - 13.07.2020

New firmware has showplan event which can be used to get new plan id when it changes.
Use this custom JS, it attaches to all elements with back class and replaces click handler with "back" action.
Code:
$(function() {
  var curr_id = currentPlanId, prev_id;

  $('body').on('showplan', function(event, new_id) {
    prev_id = curr_id;
    curr_id = new_id;
  });
  
  $('.back').off('vclick').on('vclick', function() {
    showPlan(prev_id);
  });
});



RE: Page ID on change page event - adiaz - 13.07.2020

(13.07.2020, 08:14)admin Wrote: New firmware has showplan event which can be used to get new plan id when it changes.
Use this custom JS, it attaches to all elements with back class and replaces click handler with "back" action.
Code:
$(function() {
  var curr_id = currentPlanId, prev_id;

  $('body').on('showplan', function(event, new_id) {
    prev_id = curr_id;
    curr_id = new_id;
  });
 
  $('.back').off('vclick').on('vclick', function() {
    showPlan(prev_id);
  });
});

Working perfect!

Thanks.