Manage Learn to apply best practices and optimize your operations.

Stop that WebQueryOpen!

If certain fields have not been filled in, you can use this code to stop a form from being maintained in the browser.

If certain fields have not been filled in, you can use this code to stop a form from being maintained in the browser.

If the user typed in a URL for a form, and that form usually went in some workflow order, the user would be jumping ahead in the workflow (or hacking around). I didn't want them doing either.

So, I added both lines of code to the HTML Head Content area:

@If( ParentID="" ; "<META 
http-equiv=refresh content="0; url=" + 
Base_DB_Info + "/$$ReturnGeneralError?
openform&MessageString='Unauthorized 
URL'">" ; "")+@NewLine

This META tag is included in the <head> if the ParentID field is empty, and redirects the browser to my GeneralError page with the MessageString displayed (you need a field name MessageString on the GeneralError page to show the message).

The page doing the redirecting would show for a moment before the GeneralError page would get retrieved. But it didn't look good, and the user might be inclined to hit the ESC button to try and pull a fast one. So, I added another line at the bottom of the HTML Head Contact area:

@If( ParentID="" ;"HTML 
{display:none;}" ; "" ) + @NewLine

This CSS will be included in the <head> tag if ParentID is empty. The whole <html> tag will not be displayed at all. The user gets a white screen, and then the GeneralError page.

What fun dealing with hackers.

One final note: << Base_DB_Info >> is a computed for display field. I got tired of not having the root path to the database, and got more tired of contemplating how relative the relative path was. Here's the computation of Base_DB_Info using other CGI's:

protocol := @If( HTTPS = "ON" ; 
"HTTPS://" ; "HTTP://");
domain := @If( Server_Name != "" ;
 Server_Name ; "");
dbpathold := @LeftBack(@Left
(Path_Info ; "?") ; "/");
dbpath := @Left(Path_Info ; ".nsf") ;
protocol + domain + dbpath +".nsf"

I also used s.currentdatabase.HttpURL to get the full path to the .nsf.

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

This tip was submitted to the SearchDomino.com tip exchange by member Sean Haggerty. 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 HTML for Lotus Notes Domino

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