|
|
|
|
|
|
|
|
|
|
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 --
Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.
The many included activities and demos will make you a pro! Expert instructor help is a click away.
Click here to try a FREE demo course!! |
-- Advertisement --
SECURTRAC - MONITOR AND CONTROL YOUR DOMINO ENVIRONMENT
When it comes to your business, how do you ensure compliance with SOX, HIPAA or other industry driven regulations? Use SecurTrac to monitor and audit the life cycle of all objects in your Domino environment.
- Database Monitor
- Mail Monitor
- Domino Directory Monitor
- Notes.ini File Monitor
- Intrusion Detection Monitor
Click here for details and a free evaluation copy. |
|
|
|
|
|
|
|
|