Search DominoPower's 11,441 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.
Give your Domino views life with DHTML (continued)

Once the column formula was added, I enabled the "Treat view contents as HTML" property and saved the view.

In a live system you would probably want to add your own formatting and you may wish to trap and replace any reserved characters with the equivalent HTML character entities to ensure that formatting is not lost.

Create a form to show the view through
Next I created a $$ViewTemplateDefault form. This is the default form for all Web views that aren't associated with another form.

I added a start table tag "<table>", followed on the next line by an editable text field called "$$ViewBody" (this is the reserved field name used by Domino to render the view contents -- i.e., all of the table rows will appear here) and on the next line I added an end table tag "</table>".

I then set the Pass-Thru HTML property of the table tags on the form.

Add the "Expand All, Collapse All" code
The final task involved adding the JavaScript code that would allow us to expand and collapse our document details.

The following JavaScript code was added to the JS Header section of the $$ViewTemplateDefault form.

function processForm() {
var spanElements = document.getElementsByTagName("span");
descriptions = getElementsByClass(spanElements, "description");
}

function getElementsByClass(startObject, className){
var returnarray = new Array();
var inc = 0;
for (i = 0; i < startObject.length; i++){
if (startObject[i].className == className)
returnarray[inc++] = startObject[i];
}
return returnarray;
}

function toggle(toggleType){
var state = (toggleType == "on")? "block" : "none";
var i = 0;
while (descriptions[i]){
descriptions[i].style.display = state;
i++;
}
if (toggleType == "on") {
document.getElementById("show").style.display = "none";
document.getElementById("hide").style.display = "block";
}
else {
document.getElementById("show").style.display = "block";
document.getElementById("hide").style.display = "none";
}
}

The following line was also added to the onLoad event:

processForm();

When our Web page loads we want to be able to manipulate the display properties of the "span" elements on the page. To do this we need to build a reference to each span block assigned to the "description" class.

We start by using the getElementsByTagName method of the "document" object to get all span elements and then we extract the "description" class elements from the result using the getElementsByClass function. This approach ensures that we are working only with the elements that we are interested in and not other "span" blocks that may appear elsewhere on the page.


« Previous  ·  1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Internet Technologies > JavaScript (13 articles)
   Sorting your Domino views with JavaScript
   Using dynamically generated HTML to thwart spam email address harvesting
   Implementing dynamic drop-down menus using Domino and Internet Explorer
Home > Tips & Techniques (102 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   A faster way to repair corrupted server files
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
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Teamstudio Edition 25 has shipped
It's finally here! Now that Teamstudio Edition 25 has shipped, listen to our latest Tool Time audio program to find out what's changed. Updates to all your favorite Teamstudio tools will be discussed.

Plus, you'll get an introduction to Teamstudio Undo (formerly known as Teamstudio Snapper).

Tap here to get started!

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