• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 734
  • Last Modified:

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

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
bolyogesh
Asked:
bolyogesh
  • 2
  • 2
  • 2
  • +1
2 Solutions
 
scottrmaCommented:
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
 
bolyogeshAuthor Commented:
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
 
bolyogeshAuthor Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
qwaleteeCommented:
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
 
scottrmaCommented:
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
 
Jean Marie GeeraertsApplication EngineerCommented:
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
 
qwaleteeCommented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now