Fredrik Norling
Fredrik Norling

Reputation: 3484

XAgent breaks previous navigation

If I use

context.redirectToPrevious()

It works great, but If I call an xagent with or without state between opening the document and doing a close of the document. I end up navigating to the xagent. And If I go directly to the view behind I loose opened categories in the view.

Is there a way to block an xpage to end up in the navigation/history tree?

Upvotes: 1

Views: 104

Answers (1)

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15739

There are two approaches that would work.

The first is to use client-side JavaScript to open the XAgent. How you handle that will depend on whether there are values set in the browser that you are passing to sessionScope for the XAgent to use. If not, you can just use client-side JavaScript to open the relevant XAgent page. If you do need values, there are two options:

  1. Pass them as query string parameters to the XAgent instead of storing them as sessionScope variables.
  2. Perform a partial refresh to store the values in sessionScope and open the XAgent page via client-side JavaScript either in the onComplete() event (will trigger every time) or using view.postScript(), passing the relevant CSJS as a string (will only trigger if validation is successful).

The second is to set the previous page in the beforePageLoad event and then use that value in context.redirectToPage().

Upvotes: 2

Related Questions