Reputation: 161
On my web application, I am putting all the view documents into HTML and then inserting HTML into Rich text field, this also crates button to update selected document on the form using javascript and then runs the agent to update selected documents on the web. Now in agent I am putting following code
Print |<script> alert('documents has been updated successfully');</script> |
URLtoredirect =Strrightback(query_string, "&Return=")
|
Print "[" + URLtoredirect + "]"
However if I put alert before or after this statement
Print "[" + URLtoredirect + "]"
it does not redirect to the page above instead it just prints the on the form. but if i remove alert code it works and redirects.
What would be wrong here.
Upvotes: 0
Views: 868
Reputation: 14628
A printed redirect in LotusScript only works if it is the first and only print statement in your code. That's because that type of redirect is implemented on the server side. I.e., if the first and only print statement executed by the agent starts with "[" and ends with "]", the server never sends the HTML/Javascript output to the browser. It does an internal redirect to the specified URL instead.
If you want to display a message and then do a redirect, you need to add do them both in your Javascript. I.e., something like this:
Print |<script> alert('documents has been updated successfully');location.href='| + URLtoRedirect + |');</script>|
Upvotes: 2