Search DominoPower's 11,960 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Using JavaScript to get the Query_String from a frameset (continued)

I knew I could pass the parameters I needed to customize the home pages via a Query_String, but the Query_String I had to pass the parameters to was the frameset Query_String, not the Query_String of the form itself. I therefore had to figure out how I was going to get the Query_String of the frameset from within a form that was contained in one of the frames of the frameset.

Confused yet? OK, let me stop for a moment to clear this all up. In the scenario I described above where I have a frameset composed of three frames, I actually have four Query_Strings, one for each of the frames and one for the frameset itself. In my case, I had only one form in the main body frame that needed to be customized, but I couldn't pass parameters to it directly because I could only pass them to the frameset URL. Therefore, the form needed to be able to reach up to the Query_String for the frameset and grab the parameters from there.

In order to get the Query_String of the frameset, you have to think in JavaScript. By following the JavaScript DOM (Document Object Model), you can see that the correct way to get the Query_String from within a frame in a frameset is to go through the window object as follows: window.top.location.search. Here is the code I use in order to get the frameset Query_String (which I include in the JS Header section of the form). Note that I give it a default value if it doesn't have any value to begin with, in order to prevent errors when it's passed to the "getParameter" function.

var framesetQuery = "";
if ( window.top.location.search != 0 ) {
framesetQuery = window.top.location.search;
} else {
framesetQuery = "?OpenFrameset";
}

Extracting values passed via the URL: The "getParameter" function
Now that you have a handle on the Query_String for the frameset, you are ready to pass it to another function called "getParameter" which will actually extract the value of the parameter you specify. Here is the code for the "getParameter" JavaScript function you should include in the JS Header section of your form:

function getParameter ( queryString, parameterName ) {
// Add "=" to the parameter name (i.e. parameterName=value)
var parameterName = parameterName + "=";
if ( queryString.length > 0 ) {
// Find the beginning of the string
begin = queryString.indexOf ( parameterName );
// If the parameter name is not found, skip it, otherwise return the value
if ( begin != -1 ) {
// Add the length (integer) to the beginning
begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
end = queryString.indexOf ( "&" , begin );
if ( end == -1 ) {
end = queryString.length
}
// Return the string
return unescape ( queryString.substring ( begin, end ) );
}
// Return "null" if no parameter has been found
return "null";
}
}


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  Next »
Other articles you might like
Home > Internet Technologies > JavaScript (13 articles)
   Sorting your Domino views with JavaScript
   Give your Domino views life with DHTML
   Using dynamically generated HTML to thwart spam email address harvesting
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
It's time for Lotus to double-down on Linux and open source
Back to basics with Notes: what you can do now
Back to basics with Notes: what are the basics?
Back to basics with Notes
Smart Upgrade bug in Domino 8.5.1 (and some work-around tips)
Hands-on with XPages and the Lotus Solutions Catalog
A tool for migrating Exchange to Domino
Latest Lotus Headlines
Domino 8.5.1 mail routing problem solved
A small tip for upgrading your XPages apps from 8.5.1 to 8.5.2
What is in your plugin_customization.ini?
Email Classification - What and Why?
Database transfer in IBM Lotus Quickr 8.5 for WebSphere Portal
If you are an Admin please read this - Rule No 1 The Comms Rule
Tell me about how you use the Day-at-a-Glance sidebar (or not)
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Smartphone smarts for a mobile world
David Gewirtz Online: CNN commentary and analysis
OutlookPower: The strange case of Outlook losing notes and requiring passwords
-- 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 --

Get and stay on top of all your Lotus Notes scheduled agents
With Agent Auditor you can easily gather detailed information on all of your agents or be notified when selected scheduled agents aren't running.

In addition to reporting most agent properties, Agent Auditor provides a tremendous amount of incredibly valuable information about your Notes scheduled agents.

Plus, source code for all agents (LotusScript, Formula, and Java).

Tap here and keep tabs on your agents.

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login