Using a form as a database's Homepage
What do you do when the options of what to do when a database is opened via the web just aren't good enough?
Wouldn't it be useful if you could have the database open a form as the first thing the user sees. This way you can do almost anything that you can do with forms and thus create a "homepage". There is an easy way to do this:
- Create a blank navigator and call it "webLaunch"
- Create a form called "$$NavigatorTemplate for webLaunch"
- In the database properties make the selections like those shown below.
You can now use this $$NavigatorTemplate form as you wish, in order to create a powerful homepage for your database (that is how CodeStore works). Voila.
Launch a Page,View anything on opening a database on the web
Paste the following into the top of the about document in the database and mark as pass-thru html.
<SCRIPT LANGUAGE="JavaScript"> <!-- var sPath = '/mydir/mywebdb.nsf/myview?openview' ; if ( document.images ) { location.replace(sPath); } else { location.href = sPath; } //--> </SCRIPT> <!--
Mark the rest of the about document as hidden from web users.
After setting the database to launch the about document when opened from the web. This Javascript will redirect you to the URL specified in the sPath variable.
This has the added advantage of hiding your about document from web users.
You can also use the Refresh META tag instead of the Javascript above, to redirect the page.
Another plus is this method works on all versions of Notes.
Reply
Re: Launch a Page,View anything on opening a database on the web - still problematic
Unfortunately for Netscape users, using JavaScript or Meta tags to do a redirect when attempting to load a form on database open will mean the user can never hit their "back" button. Bad UI design, I've found the "$$NavigatorTemplate for WebLaunch" the only workable solution, I'm still waiting for someone to come up with a better solution.
Reply
Show the rest of this thread
USing a form as a Db's Home page
Good tip.I agree about being clear about the message being refrred to.The last comment was misleading and i was'nt sure what he was talking about
Reply
Re: using a form as A database's Homepage
Hey Jake, I found a problem with using the NavigatorTemplate for webLaunch, you lose all your editable fields. It's great if you have a static page or form with compute for display fields to display info, but any editable fields,(like combo boxes using dblookups), will not appear. Is there another possible solution for this?
BTW, codestore is a great developer's resource, keep up the great work!
Reply
Re: using a form as A database's Homepage
I have the same problem. If I want a search box in my home page, Do I have to write its html code?
It seems that it is possible have the same result using a page instead of $$NavigatorTemplate or not?
or What can I do using $$NavigatorTemplate not possible in a Page?
Reply
Show the rest of this thread
Re: using a form as A databas...(maybe a solution)
Hi guys,
For me the editable fields issue is a problem when I apply the navigator solution.
Let me point out an approach which may lead to a solution:
Create a document with a form (ie HomepageForm). After a document is created add the SaveOptions field, make it computed and set a value equal to "0" (never save the document).
In the db launch options select the open first document in a view and arrange that the saved homepage document is always first, to be opened.
The HomepageForm is checked to always be opened in edit mode!!
Based on the the above the db will launch a document in edit mode (contains editable fields used for search as an example) but the document will never be saved again to be modified.
What are the drawbacks you see...?
Costas
Reply
This is great, but ...
Thanks, Jake. This is cool.
Of course the better solution would be for Iris to give us "Form" as an option. I've had to do various kludgey things to open my dbs, and this is slightly better, but why do we have to go to the trouble?
Better yet, why don't they have an interface like they do in Frames (?) where you can refer to any design element,either by name or through a formula.
Reply
Can't get a cookie to be recognized with either
I tried using a page and using a $$NavigatorTemplate launch form. Neither method allows me to grab a cookie when using this launch method without explicitly calling the design element in the url: "http://domain.com/db.nsf" or "http://domain.com/db.nsf?open" does not work. But "http://domain.com/db.nsf/WebLaunch?OpenNavigator" does work.
The only cookie returned when calling just the database is the DomAuthSessId. When the weblaunch is called, the existing cookie and the DomAuthSessID are both returned, which is what I expect. Server is 5.0.10. I also tried turning off Single Server authentication with same results.
Has anyone run into this? Is this a bug? Am I not doing something right? Any thoughts on a work-around? I would prefer not having to tell clients to put the design element names in the url.
Thanks for any help on this.
Reply
Re: Can't get a cookie to be recognized with either
Just in case anybody wants an answer to this 2 year old post, maybe this will help?
Generally the cookie path should be set to "/" so all apps on a domino server can see the cookie, otherwise defaults to current path when set, which usually blocks the cookie from being seen.
Reply
Show the rest of this thread
What about http_referer?
This idea is almost perfect. The one thing that I can't seem to do is to get the http_referer field to display anything on my $$NavigatorTemplate form.
Here's what I was planning to do:
We have a single Domino server that hosts a number of sites. Each site has it's own domain name, but the domains can only point to a single IP address like 'http://1.1.1.1', not a db address like 'http://1.1.1.1/hello.nsf'. To solve this, I was going to set up a db called home.nsf with the $$NavTemplate as the default form to load when the server is hit via browser. On that form I was then going to look at http_referer to see which site a visitor was trying to hit, set the window title based on this and then do a redir to the specific db they were after in a single frame (I know, frames are bad, but the sites in question use them anyway). If http_referer would work, then my redirection idea might work. Any ideas on why this field refuses to show up?
Reply
Re: What about http_referer?
Hmm, HTTP_REFERER. One huge source of confusion.
Here's how the field works. You go to the website of Company X (www.x.com) and there's a link to the webpage of Company Y (www.y.com). You click the link and go to y.com. Here, Company Y can see that you came from x.com.
On the other hand, if you were at x.com and decided to visit y.com by typing it in to the address bar, Company Y would not know you were currently at x.com.
Also, if you set up a redirect/default homepage on the server then this is just sending that page to the browser instead. This is not the same as being reffered them from a link. Hence, the field will be empty.
Consider using Server_Name instead.
Jake -codestore.net
Reply
What about
I know this post is donkeys old but what is wrong with the "Open first document in view" option. You have a form called lets say Home and a view called lets say Home - you create and save one Home form Notes side and thats that. You set the db props and the form will always open. If you want it editable - set the form properties as always open in edit mode. Just make sure you never create more than one Home form or if you do that the view is sorted the way you need it.
Reply
Using a form as a database's Homepage
excellent tip; I've been wanting to do this, trying to figure the best way. I had ended up using a graphic on a page as a splash screen.
Reply
alias $$NavigatorTemplateDefault to the $$ViewTemp
If you want to open with a view, give the $$ViewTemplate(Default) with an embedded view the alias of $$NavigatorTemplateDefault. Create at least one Navigator and reference to it in the open properties of the database.
Maybe this is what Jake ment in the beginning, in his tip he didn't explicitly mention working with aliases. It is so much easier when you have e.g. a view called "Home" that can be referenced through urls in you application as /home?openview or even just as /home, but having that view also open from http://yourserver/yourdb.nsf.
Reply
Launching a flash file??
This is an excellent trick but if anyone knows how to insert a Flash .swf file in the "$$NavigatorTemplate for webLaunch" and get it to display instead of hanging and displaying nothing I would love to know how!
At my wits end..lol
Reply
A problem as old as the hills, but still (sort of) unsolved for forms/views applications.
While the $$NavigatorTemplate solution is still as elegant as unintuitive and much better than most of the other hacks, there is one drawback, that has not been mentioned, yet: Navigators cannot be made public.
That means, even if anonymous access is set to "No Access, read/write public documents", unauthenticated users will get an error.
One could possible trick around this and use code to add the $PublicAccess field to the design note, but that's a hack within a hack and doesn't sound very robust to me.
My current solution is to use the web launch option "Launch designated doclink" and to NOT paste a document link, but a VIEW link instead. Surprise, surprise: it works! The view link can be easily copied from the Notes client Edit menu.
You probably see the potential. Being able to launch a view means, you can use a view template (that might or might just not display the chosen view). View and view template can then be made available to public access through the UI, if desired. I have successfully tested this in Domino 7.0.4 and 8.5.3.
To me, the biggest disadvantage is, that you cannot really see in database ... oops ... application properties what has been pasted as a "doc" link. You can however use the "Go To Doclink" button to check.
Reply
And just in case Jake really decides to publish the above comment: This technique has been in use at least since 1999 using Notes 4.6.
And giving it some afterthought, there are more serious drawbacks:
This setting can not be inherited from a template. :-(
It does not work well with multilingual databases, since the view link can always only point to one view exactly. :-(
Well ...
Reply
As a previous commenter your comment are auto-published ;-)
It's a good hack and I'd happily publish it either way. It's a shame there are drawbacks. Not as much of a shame as it is that these hacks are needed in the first place though!
Reply