Using sample code from discussion DB

Hi, I have a web app and I am trying to use some code that I found in the Discussion DB (notes & web) available with Domino 6.5.4.

The code save into a profile field the name of the view from where the user is creating a new document:

viewname := @Subset(@ViewTitle; -1);

@SetProfileField(“tmpProfile”; “viewtitle”; viewname);

@PostedCommand([Compose];“MainTopic”)

And then, when the form has been displayed, if the user does a click on “Cancel”, these code is execute:

CurrentView := @GetProfileField(“tmpProfile”; “viewtitle”);

@Command([OpenView]; CurrentView)

It suppose to retrieve the view name stored previously, but sometimes, it is returning any other viewname, only after many “New Topic” and “Cancel” clicks, the profile field seems to have the correct value stored. It could be an issue related to cached profile on web?.

There is no problem when an existing document is opened, because, I am using directly the @Subset(@ViewTitle; -1) to the open view, and profile document is not involved.

Any suggest will be appreciated

Regards,

Oswaldo Escobar Mendoza

Lima, Perú

Subject: Using sample code from discussion DB

Take a look at CGI variable : HTTP_Referer. It’ll give you the URL of the page the user used to get into the document.

HTH

Adi

Subject: RE: Using sample code from discussion DB

Thanks for your answer, I tried HTTP_Referer, but only get value when open an existing document in read mode. When enter in Edit Mode (using @command([EditDocument])) or when Creating a new document (using @command([compose])), HTTP_Referer returns an empty string.

I have put a field called HTTP_Referer, computed when display, with value to HTTP_Referer. Also have tried with Computed, en Editable with similar results.

I have change my action buttons to Jscript and storing in a cookie the window.location before change it to ‘/db.nsf/myform?openform’. After open the new document. I’ll read the cookie and set a field with its value. I’ll use that value in the ‘Close’ action.

Let me know if I am in wrong way.

Regards,

Oswaldo Escobar Mendoza

Lima, Perú

Subject: SOLVED!!!

Finally I have found the solution using JScript and Cookies, thanks to AdiBabu K for let me see the ligth at the ond of tunnel ;-).

Changed all formulas related to compose and file close, to javascript. I code some functions to change window.location with a calculated URL, even when the document to create is a response and need the ParentUNID parameter.

The change involves views, view templates, forms and script libraries for handle cookies.

regards,

Oswaldo Escobar Mendoza

Lima, Perú