Did You Know - 1: Dynamic Urls for Notes
This morning, while training a few developers, I stumbled upon a piece of functionality I would've never thought existed in notes:
I was teaching the pro's and con's of using qualified vs relative vs dynamic urls, and made good mention of @WebDbName and it's benefits. In my example, I wanted to show how a url would look in order to "compose a form" when creating hotspots in Forms or Pages. Below is an example of how this could be done, from worst to best:
QUALIFIED URL = "http://www.domainname.com/ApplicationFolder/DatabaseName.nsf/FormAliasName?OpenForm"
RELATIVE URL = "/ApplicationFolder/DatabaseName.nsf/FormAliasName?OpenForm"
DYNAMIC URL = "/" + @WebDbName + "/FormAliasName?OpenForm"
When one of the developers asked me what would happen if just adding the "/FormAliasName?OpenForm", leaving out the beginning "/" and @WebDbName, I laughed and said that the url returned will be dodgy and incorrect. Been a person who believes in visually proving a point, I changed the code in my hotspot, and added the following url, "FormAliasName?OpenForm", not realizing that I accidentally left out the "/" before the "FormAliasName". Low and behold, the result was a fully qualified url where the domain, filepath and file name were dynamically generated by Notes itself, without any need of using @WebDbName.
BOTTOM LINE:
"FormAliasName?OpenForm" - WORKS and REPLACES "/" + @WebDbName + "/FormAliasName?OpenForm"
"/FormAliasName?OpenForm" - DOESN'T WORK
N.B. The Above example assumes that you are composing a Form on the current server, in the current database.
Cheers John
|
Did You Know - 1: Dynamic Urls for Notes
|
1 Karl-Henry Martinsson Permalink This is actually not a function of Domino, but of the browsers.
What you call "dynamic URL" is just a relative URL being built
dynamically. You can build fully qualified URLs dynamically as
well.
The same way as you in a traditional HTML page can reference
another page (or image) in the same directory without specifying
the path (relative or fully qualified), you can do that in Domino
as well, for items that are on the same "level".
So in your example, you are in a form and call another form. They
are on the same level, and you do not need to specify a path, the
same way as if you would have foo.html and bar.html in the same
directory and reference one from the other.
The reason the "/FormAliasName" does not work is that the browser
then start at the top of the server, not including the database
path and filename.
2 John Jardin Permalink Note Taken. Thanks for the feedback. :)