|
|
|
|
|
|
|
|
|
|
JAVASCRIPT FOR FUN AND PROFIT
Using JavaScript to get the Query_String from a frameset
By Dan Velasco
At my company, we recently received an application a consulting company had created for us that had a fatal flaw. Well, maybe not a fatal flaw, but definitely one that would make developers want to slit their wrists because of all the maintenance and customization involved.
It was an e-commerce application designed to assist our customers in buying our products. The main page was a frameset with three frames: a top frame, a left-hand side frame, and a main body frame. The main body frame, by default, contained login information, and that was all, as you can see in Figure A. The challenge we faced was that we wanted to create custom home/login pages for each of the products showing a picture of the product along with a customized welcome message.
FIGURE A
The default screen only contains login information, challenging us to customize it for each of our products. Click picture for a larger image.
The fatal flaw in the application the consulting company had created for us was that in order to create custom home pages for each of our products, it required the following steps:
- Create a new frameset and then name it after the product;
- Create a custom home page Domino form for the product;
- Create a configuration document for each product that includes such information as the name of the product, its home page URL, and an attached file that contains a picture of the product, among other things.
In case you're keeping count, that's two Domino design elements that would have to be created for each product. Multiply this by an initial set of almost 30 products and you get the picture of how unwieldy this could quickly become. As you are no doubt thinking, the method above does not require a lot of skills but it does require that the person who is creating these custom home page framesets and forms have a Notes Designer client. Gee, whom would they come to with change requests?
This solution was simply unacceptable to me, and I knew there had to be a better way. Well, there is, and all it involves is a basic understanding of JavaScript, Query_Strings, and the code I am about to give you. The solution outlined in this article is designed to work in Notes/Domino R5 only. For a sample database containing the complete code described in this article, please go to http://dan.velasco.com.
How do you get the Query_String of a frameset? OK, here's a quick refresher. The Query_String is the part of the URL that usually starts with either the question mark or exclamation mark, as the case might be. For instance, in the URL http://sample/db.nsf/MainFrameset?OpenFrameset&fname=Dan&lname=Velasco, the Query_String would be "?OpenFrameset&fname=Dan&lname=Velasco". There are two parameters, one called fname with a value of "Dan" and one called lname with a value called "Velasco." When you are not using framesets, it is fairly easy to get and manipulate the Query_String using a computed for display field on the form set to Query_String or by getting doc.Query_String(0) via LotusScript. When the form is in a frameset, however, you've got to take a different approach.
[ Next ]
|
|
|
|
|
|
-- Advertisement --
2-Minute Tutorials
How do I...
- integrate MS Office or OpenOffice with Notes?
- create cross-tab reports and charts?
- print serial letters and mailing labels?
- create PDFs in Lotus Notes?
Check out the 2-minute tutorials here. |
-- Advertisement --
The Ultimate Notes Domino Training Experience - Amsterdam, 11-13 November
Get in-depth technical training that you can put to use on the job right away at THE VIEW's Admin2008 and Lotus Developer2008 Europe! One registration gets you into your choice of over 70 new and updated expert know-how sessions, one-on-one consultations, hands-on labs, and more.
See complete agendas and register by 10 October to save 495 euros! |
|
|
|
|
|
|
|
|