?
Solved

How to use Query String to pass the value and how to collect it

Posted on 2003-03-27
9
Medium Priority
?
709 Views
Last Modified: 2013-12-18
Hi All,
     Actually I am very new to lotus things.I want to pass the value of current URL at the click of a link.So i am passing is as a query string as :
...&refurl=\'+document.URL\" as in the following code :

"[<a href=\"javascript:window.location.href=\'./vw_MyDigibillStatus/"+ @Text(@DocumentUniqueID) +
"?OpenDocument&hide&refurl=\'+document.URL\">" + @Text(RequestNo) + "</a>]"

and i created Query_String field in the next form. Query_String field is a computed field with the formula @Right(Query_String;"&refurl=")
but this is very uncertain to retrieve the URL. with the same code some times it works properly and many times i could capture the URL. Am I doing anything wrong?
Please suggest.
thanx
Yogesh
0
Comment
Question by:bolyogesh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
9 Comments
 
LVL 7

Expert Comment

by:scottrma
ID: 8222882
If the URL you are trying to capture is the previous link that got you to this page (if I have understood your question correctly), then you would want to use the HTTP_REFERER variable.

Regards,

Scott
0
 

Author Comment

by:bolyogesh
ID: 8222912
Hi Scott
thanx for your reply.
here is more details of my problem :
My problem is to get the second last page visited after clicking the save button on the last page (form).
In fact in application, after clicking one link - "Request Staus", the page is displayed showing all the requests in the view. The view has been directly used for that. All the requests are displayed category-wise. After opening the twisty of the category, it displays the list of the requests. On clicking this request link(here the URL is passed as Query String), the form is displayed showing the details for that clicked request.On click of the Edit button the form opens with all editable fields and with cancel and save buttons on it.On click of save  button i want to do @Command[FileSave] and then
URLOpen[the url passed by the query string].
   I hope I didn't confuse you.

thanx
Yogesh
0
 

Author Comment

by:bolyogesh
ID: 8223608
Hi Scott
thanx for your reply.
here is more details of my problem :
My problem is to get the second last page visited after clicking the save button on the last page (form).
In fact in application, after clicking one link - "Request Staus", the page is displayed showing all the requests in the view. The view has been directly used for that. All the requests are displayed category-wise. After opening the twisty of the category, it displays the list of the requests. On clicking this request link(here the URL is passed as Query String), the form is displayed showing the details for that clicked request.On click of the Edit button the form opens with all editable fields and with cancel and save buttons on it.On click of save  button i want to do @Command[FileSave] and then
URLOpen[the url passed by the query string].
   I hope I didn't confuse you.

thanx
Yogesh
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 31

Accepted Solution

by:
qwaletee earned 100 total points
ID: 8236794
Make sure QUERY_STRING on the form is a ***computed for DISPLAY*** field.  If it is editable or computed, it will save its value the first time, and not recalculate later (using only saved value).

If you do change this, your existing documents will still have the saved value, and will continue to fail if used again, unless you delete the field from the documents.
0
 
LVL 7

Assisted Solution

by:scottrma
scottrma earned 100 total points
ID: 8242124
You could create an agent to do this. In your agent, the very last line would be something like this:

Print "[URL that you want to redirect user to]"

You can get a handle to the Query_String through NotesSession.DocumentContext.Query_String(0) and then use this as part of your URL that you want to redirect users to. Then call this agent in the WebQuerySave event of the form:

@Command([ToolsRunMacro]; "Your Agent Name")

Hope this helps.

Scott
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 8245046
Here's a tip to get any paramter you pass from the URL, maybe this can help you:
Create a computed text field with the following formula:

vParam := "&Date=";
vSubString := @RightBack(Query_String_Decoded;vParam);

vValue := @If(
     @Contains(vSubString;"&");
     @Left(vSubString;"&");
     vSubString
);
vValue

You specify the name of the parameter you want to read in vParam:=
in your case use :
vParam:="&refurl=";

The vSubstring will get the right part of the Query_String_Decoded CGI variable (you can also use Query_String if you want to keep the string coded).
vValue will hold the final value of the parameter, if an & is ecountered in the vSubString, it will be truncated till just for this.

I hope this can help you in any way.

Regards,
JM
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 8321163
Do you need the exact URL?  Or isit enough to go back to teh same view?  if so, code your edit document button as a formula @COmmand([EditDocument]) -- Lotus will insert the view ID in the URL.  And code your save button as @COmmand([FileSave]); @COmmand([FileCloseWindow]) -- Lotus will automatically direct the user to the right view, through without any parameters (so the twisties will all be closed, and the user will be at the top of the view).

Otherwise, code as follows:

HTTP_REFERER needs to be computed for display
Edit document needs to be a URL: "/" + DbFile + "/0/" + @Text(@DocumentUniqueID) + "?EditDocument&refurl=" + HTTP_REFERER
(You can set up DbFile yourself -- use @ReplaceSubString @SUbset @DbName
Add an EDITABLE field on the form called REFURL, with HTML attribute HIDDEN
Put JavaScript on your form to move refurl from the URL to the field refurl
Save formula: @Command([FIleSave]);
$$Return field - computed for display - @If(REFURL=""; 'Thank you for submitting.  Please return to the <A HREF="/' + DbFile + '">main page</A>"; "[" + REFURL + "]")

What's going on:
It is somewhat difficult to track the REFURL via QUERY_STRING, because QUEY_STRING is calculated when the document opens, not when the document is saved.  So, when the edit form displays to the user, Domino allows caluclations on QUERY_STRING, but when it is saved, there is a new QUERY_STRING.  If the QUERY_STRING field is editable, it will retain its value from the open to the save -- but it will keep that value forever, unless you remove it.  So, the third, foruth, fifth time you edit, it would still be using the original QUERY_STRING value, which is wrong.

So, you make it computed for display, so it doesn;t save.  But then, the value is the QUERY_STRING from the save, which is a ?SaveDocument" I think, not the same value as when the user started editing.  You lose your refurl value.

Instead, what I've done, is have the web page itself (client side JavaScript) copy teh value from the URL into a hidden field on the form.  Unlike the QUERY_SAVE computed for display solution, the value is saved permanently.  Unlike the QUERU_SAVE editable solution, JavaScript takes care of making sure the value is updated in each edit.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question