Link to home
Start Free TrialLog in
Avatar of snocross
snocross

asked on

Return to previous webpage

A while back I had a problem where I was trying to return the user to the previous page they were in and Zvonko gave me a solution:

Click here if you want to see original question:
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?qid=20150041


Anyway his solution was placing this code in my $$Return

"[/" + @SubSet(@DbName;-1)+"/"+@SubSet(@ViewTitle;-1)+"]"


This worked great accept now I have a user who has expanded several categories in a view to find a specific document, and when they open the document and then save the document the $$Return brings them back to the original view successfully however the view categories are not returned to the same state that they were in... ie: some categories should be left expanded, and some should be left collapsed etc.  Instead it is auto-expanding EVERYTHING.

Any ideas to return the view to exactly how the user left them?
Avatar of Arunkumar
Arunkumar

Hi Sno !

:-)
Avatar of snocross

ASKER

Howdy friend!  That was fast!
Hi Sno!

Hello Arun, I have posted a proposal to your dsk problem :)

Sorry Sno that I got a bit quiet at last time, but I am overworked :)

For your view state problem is a CGI variable HTTP_REFFERER to be used. But to get exact scenario I have to test a bit.

Is this view to be reopend displayed in applet or html mode?


Hi Zvonko,

HTML mode.
OK, I test my idea and come back again...

So long,
zvonko

Sounds good!
Sno, The solution was already available in the thread . Check out for my comment in the link.

~Hemanth
I got it Sno!

Here it goes.
Create two fields on your document form.
One field name has to be: HTTP_REFERER
For the next (to the right side) field is the name not important, but I sugest this name: LastView
The formula for LastView has to be this:
FIELD HTTP_REFRER:=HTTP_REFERER;
FIELD LastView:=LastView;
@If(@Contains(HTTP_REFRER;"?OpenView");@SetField("LastView";HTTP_REFERER);"")

So you can use the value of the field LastView in your $$Return field like this:
FIELD LastView:=LastView;
"["+LastView+"]"

Important note is to set Form property: GenerateHtmlForAllFields

Tell me how it works in your environment.

So long,
zvonko

PS. there a surely some situation not corectly handled, but test this first version. The improved version will follow :-)

Hi Heman,

the Http_Referer alone is not the solution because every document refresh or recalculation set the Http_Referer to the previous document link and loose the view link.

In my proposal is the $$Return check not handled when LastView was empty. This I have to test and provide.

Gotcha.
Hey Bro & Buddy !!!

Howdy ?

Bro, I have grooved lots of messages and posts for you.
And whom are you playing chess with ?  Is the next move mine ?

;-)
ASKER CERTIFIED SOLUTION
Avatar of zvonko
zvonko

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CRAK
Have you tried my suggestion in the previous discussion?
Simply store the entire views URL in every (viewtemplates?) onLoad-event and allow javascript on documents to retrieve that value and reload it.
It automatically resists document refreshes, reloads, section expansions etc. without a whole lot of effort!
If you're not yet using a frameset: try a simple single frame frameset....
Hi CRAK,

your JavaScript proposal is a browser client side solution. I would prefer it for page display mode.
But when you post a form to be submited to Domino, then you can not redirect to the View because you have to save document first.

Framset or no frameset does not make difference in this client side redirection concept.

Listening...
In cases like this, the use of HTTP_Referer isn't always very suitable: expanding/collapsing sections, refreshing on keyword changes etc. makes you lose track. Can't say that I never use it though!

My approach overcomes that, though it has a different disadvantage: if a category is changed (i.e. new one is added, appearing higher in the view than the expanded category), you'll still get the wrong category opened. In cases where categories can not be user defined, that should be no problem.

Zvonko, I don't understand your remark: yes, it's a browser client side solution, but what's wrong with that? I use document.forms[0].save to, to avoid the problem you describe. No need for $$Return!

I've posted a little demo on my site (will remove it in time): http://home.wanadoo.nl/ralph.kersten/temp/ret2vw.zip (sorry, haven't got a www-domino server). It starts (as indicated) in the frameset.

Suggestions are welcome!

By the way Sno, how did the user expand "several categories" in an HTML-view?
There was several groupings and they would click one group at a time until they found their document.  Then when they went back they would have to click the multiple levels of groupings again.
This did exactly what I needed.  Thanks everyone!