Manage Learn to apply best practices and optimize your operations.

Return Web user to any element from an agent

This tip shows you how to return a Web user to any element from an agent with a wait time.

This tip shows you how to return a Web user to any element from an agent with a wait time.

Use the following subroutine call at the end of any agent processing to redirect any element within the current database (or to any other database or URL).

Using a Combination of LotusScript and embedded JavaScript, this code offers a very flexible method of redirecting the Web user from within an agent to another page. It works well with both R5 and R6.

This method uses JavaScript code to extract the current database from the agent where it was run. (You can use LotusScript to get the database URL, but I find it easier this way without worrying about getting the server name, database name etc.)

This allows the user to see a fleeting message on screen for a designated amount of time (e.g., Thank You your Request has been submitted!). You can control the amount of time the message is being seen.

This may also be useful when you want the user to wait a few seconds (for example, redirecting to a newly indexed view) before redirecting to the view. Here the wait is at the browser client and not at the server, so you have more control over what you can display during this period.

  
 Sub returnToElement(elementName 
as string, elementType as string, 
waitTime as Integer)
 
 'This prints the javascript to return the
 user to the designated element
 redirectTo = "/" + elementName +
 "?open" + elementType
 
 Print "<body>" _
 + "<script language=
'javascript'>"_
 + "window.setTimeout
('WinReplace()',"+cstr(waitTime)+");"_
 + " function WinReplace(){"_
 + "window.location.replace
(window.location.href.substring
(0,location.href.lastIndexOf('.nsf')+4)
 + '" + redirectTo + "');}"_
 + "</script></body>" 

End Sub

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Sandeep Goyal. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close