?
Solved

After deleting a document in a view, how to redirect the page to the view>

Posted on 2005-03-09
12
Medium Priority
?
405 Views
Last Modified: 2013-11-16
Hi,
   I open a document in a view and delete it with an Action button. The code in the button is @Command([EditClear]). It deletes the document. My problem is, it gives me a page saying 'Deleted'. But I want the parent view to be displayed and refreshed instead of this page. I've a $$Return field in the form which directs the control to the view. But it works with Submit action only.
 Thanks in advance
0
Comment
Question by:smithajohn
[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
  • 4
  • 4
  • 4
12 Comments
 
LVL 15

Expert Comment

by:Bozzie4
ID: 13495446
Yes, you can use another $$ field  for this.

$$ReturnDocumentDeleted

This is from designer help :
Adding the message field
Create one of the following fields to hold the error message:
An editable text field named MessageString to display the default server-generated error message.
A computed-for-display field whose formula replaces the default error message with a customized message.
For example, this formula for a field named CustomString on a $$ReturnAuthenticationFailure form gives more information to the user if authentication fails. The formula takes the value from the default MessageString field if it contains "unauthenticated" and replaces it with instructions to the user. If the MessageString field does not contain the word "unauthenticated", Domino uses the value of MessageString instead.
@If(@Contains(messagestring;"unauthenticated");"Sorry, the name and password you entered are unknown in our system. If you are new to our site, return to the home page and follow instructions for registering.";messagestring)

0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 13495463
Sorry, a FORM named $$ReturnDocumentDeleted (the help text confused me a bit)

cheers,

Tom
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 13500952
Hi Bozzie4,

Hmm, I wonder if a simple $$Return would work -- @COmmand([EditClear]); @Command([OpenView]; "default view name")

Best regards,
qwaletee
0
Industry Leaders: 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 15

Expert Comment

by:Bozzie4
ID: 13503584
No that doesn't work , I just tried it.  Maybe if the formula is rewritten to something more complex ...

cheers,

Tom
0
 

Author Comment

by:smithajohn
ID: 13504751
Hi Bozzie4,
    I also went thru the help and did the same mistake as you said($$ReturnDocumentDeleted field).
I tried it with $$ReturnDocumentDeleted form. When the doc is deleted succesfully, my MessageString will be empty.
I've given ' @If(MessageString="" ; "http://.../"viewname"?Openview" ; MessageString) ' in the formula field. Is this the way?
Instead of the "Deleted" page it gives me a page with a link to the View. I tried @Command([OpenView]) in the @If , but it doesn't work.
Any way to to goto the view directly as in $$Return field?
thanks..
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 13508746
What might work better for you...

Instead of using a button with the @Command, use a link to the following computed URL:
    "/" + @ReplaceSUbstring(@Subset(@DbName;-1); " " : "\\"; "+" : "/") + "/DeleetDocument?OpenAgent&" + @Text(@DocumentUniqueID)

Create an agent:
    named DeleteDocument
    Shared
    set to run with web user's rights
    Run against No target or Run Once (@Commands may be used)
    Using LotusScript
    Place the following code in Initialize

Dim s as new notesSession
Dimc control as notesDocument, db as notesDatabase, target as notesDocument, pos as integer,insruct as String
Set control = s.documentContext
Set db = s.currentDatabase
instruct = control.Query_String(0)
pos = Instr(instruct,"&")
If pos = 0 Then
    Print "Missing document delete instruction"
    Exit Sub
End If
instruct = Mid$(instruct,pos+1)
If Len(instruct) <> 32 Then
    Print "Invalid document delete instruction"
    Exit Sub
End If
On Error Resume Next
Set target = db.getDocumentByUnid(instruct)
If Err <> 0 Then
    Print "Unknown document delete instruction " Erl Err Error
    Exit Sub
End If
target.Remove
If Err <> 0 Then
    Print "Failed document delete instruction " Erl Err Error
Else
    Print "[..]" 'redirect to database home page
End If



0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 13509787
Or put this in the htmlhead section of the Form :

"<meta http-equiv=\"refresh\" content=\"1;url=/"+ @webdbname++"/theview?openview\">"

This will redirect the user automatically to the view.  Not a perfect solution, but at least easy to do :-)


cheers,

Tom
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 13518807
Well, heck, you could just give the "$$ViewTemplateFor [main view name]" form an alias -- $$ReturnDocumentDeleted

Wouldn't that be even simpler?
0
 

Author Comment

by:smithajohn
ID: 13542219
qwaletee ,
       Loads of thanks for that. The agent is working fine.

Bozzie4,
     The HTML head code doesn't seem to be working. It will take the control back to the view even before I click the "Delete' button.
and in the load event of $$ReturnDeleteDocument , u can give location.href="...?openview". It will also redirects to the view instead of giving the link(when u use the computed field and Messagestring, it gives a page with a link to the view).

      But there is another bottleneck now...I want to give this delete option in many views. How do I get the viewnames in a global variable? so that I can use this variable in the agent.
I tried it in the Global section of the view(getview). But it returns an empty string.
I invoke the views thru Hotspont links from the navigation page.

Will give another 100 points for this....

thanks.
 
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 375 total points
ID: 13576993
You don't need to know every view.  If you use HTTP_REFERER, you can use the prior URL to get the view name or view UNID, and just redirect to that.

For example, if the document opened via
    http://server/folder/file.nsf/0123456789abcdeffedcba9876543210?OpenDocument
then you just pull off the
    http://server/folder/file.nsf/0123456789abcdeffedcba9876543210
as the view URL.  The view UNID is 0123456789abcdeffedcba9876543210, and that URL alone is enough (you can append ?OpenView if you wish).

Sometimes the document URL will change as it is being edited, or may have additional parameters of some other sort.  The following will stil work:

    http://server/folder/file.nsf/0123456789abcdeffedcba9876543210?OpenDocument&Seq=7&RestricToCategory=Qwaletee+Category
still resolves properly to view URL
    http://server/folder/file.nsf/0123456789abcdeffedcba9876543210
0
 

Author Comment

by:smithajohn
ID: 13598290
thanks, I'll try it out....
0
 

Author Comment

by:smithajohn
ID: 13642947
Thanks   qwaletee ....
So you get 125+100=225 points !!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
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

762 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