Welcome!

You will be redirected in 30 seconds or close now.

ColdFusion Authors: Yakov Fain, Jeremy Geelan, Maureen O'Gara, Nancy Y. Nee, Tad Anderson

Related Topics: ColdFusion

ColdFusion: Article

Build a Better Help Screen

Build a Better Help Screen

The U.S. Fish & Wildlife Service had lived with their ColdFusion-based, accomplishment-reporting Web site for about a year. The application allowed employees to report field accomplishments to area managers who then edited and released the reports for internal-only or public review on their Web site, or via e-mail or fax to the media or Congress.

I had used a fairly standard frame layout with a header, logo corner, left menu, and main area. Additionally, there was a narrow strip under the title where a drop-down selector and a user identifier were loaded when field reps signed in. I added a small panel at the bottom where help information would be displayed whenever a help icon was clicked.

The help table is simple, consisting primarily of a short, text-based, key-term field and a longer memo field that holds the help information.

Can't See the Trees
Even with six frames, the main viewing area was adequate on a 17-inch or larger monitor, but smaller screens were a tangled confusion of scroll bars and mini-panels. Employees (field reps) might be using the latest computer equipment or antiquated computers with 14-inch monitors. The field reps with the smaller monitors found it difficult to view the tiny main panel, and the vertical and horizontal scroll bars made even more of a mess (see Figure 1).

My client gave me free reign to do anything to provide more room for the main display area. I tightened the frames and moved the menu onto the user information strip by using smaller buttons (see Figure 2).

I had removed the narrow help strip at the bottom, but still wanted the ability to display help information to users without causing them to lose their place on the web site - especially if they were in the middle of filling out a form. I could have used the <A title="help text here" > </a> approach, but the help information is pulled from a database to allow it to be updated over time. I didn't want to add to the page-load overhead by querying the help table on every page that had a help button. I could have used a target= "_blank" anchor to display help information in a new browser window, but I wouldn't have had control over its size or location. I felt it would confuse users if some or all of the main window was hidden when the new browser window was spawned.

JavaScript Limitations?
JavaScript seemed to be the way to go, but I hadn't taken the time to learn it yet. I picked up a beginner's book and began to read in earnest. My first attempt at solving the problem was to write a function that would dynamically load the results of a ColdFusion query and display it in an alert box. My theory was that I could use the <IMG> tags' OnClick() function with a parameter to initiate a query, load the information into the alert box, and display the help information to the user. Very clean, very professional looking, and I get to keep my newfound screen real estate.

JavaScript refused to cooperate. I tried several methods, but couldn't get the information into the alert box unless I queried the help table every time I loaded the page.

One Step Forward...
Back to square one. I found an example where JavaScript was used to create a new window and dynamically write an HTML page. I created a working CF script and copied it into a JavaScript function. Clicking the button was supposed to execute the function that was, in turn, to write the code into the new window.

Still no go. JavaScript executed the embedded ColdFusion instructions as soon as I loaded the parent page. Trying to fool it with """ or any other workaround didn't get me anywhere because the resulting dynamically written file was an HTML page, not a CF script.

Never Say Die
I'm not easily deterred by a few minor setbacks, but this problem was looking an awful lot like my JavaScript Waterloo. Suddenly, I had a revelation: what if the program I wrote called a static ColdFusion script that then handled the query and generated the results?

Even better, I discovered that the first parameter of the JavaScript "open" function would call a URL. The solution was simple! Use OnClick() to call a function with a parameter. The function would create a new window and call a ColdFusion script with the help query parameter. The results of the CF program would populate the new JavaScript box.

First I needed a ColdFusion program that would search the help table for a parameter and display the results of the query. HelpLine.cfm (see Listing 1) searches for the key term and outputs the query results (see Figure 3). The Close button (also JavaScript) provides a clean method of exiting, and the topic is displayed in light gray at the bottom of the screen. Displaying the topic name helps you find that specific item later when you need to update the help text.

To make this help-display capability available to all the CF programs in that application, I loaded the HelpWindow() into the Application.cfm file. This function is to be called with a parameter. HelpWindow() creates a new, nicely formatted browser window, then executes HelpLine.cfm, which populates the window:

<script language="JavaScript"> function HelpWindow(TheTopic) { window1=window.open("helpline.cfm?topic="+TheTopic, "NewWindow1","toolbar=no,directories=no,menubar=no,scrollbars=yes, width=600,height=300,left=200,top=100"); } </script>

The final piece of this puzzle is to enable a call to HelpWindow() with the appropriate parameter when the user clicks on a help button; we do this by placing the function name in the OnClick method of the <IMG> tag. Note the location of the parameter GEOREGION. We'll pass it through HelpWindow() to Help-Line.cfm where it can be used in the query to find the appropriate help information:

<img src="../images/btnHelp.gif" width=15 height=15 alt="Click on the question mark to display information about this item. It will appear in a new window in the middle of your screen." border=0 align="middle" onclick="HelpWindow('GEOREGION')">

Recyclable
This code can easily be reused, enabling you to quickly provide professional-looking help displays with minimal effort. To recap, here are the four elements necessary:

  • HelpLine.cfm
  • HelpWindow() in Application. cfm file or the CF script it's called from
  • Help database, populated with data, and a datasource link
  • OnClick() functions of <IMG> tags programmed with the ap-propriate help parameter, as in OnClick="HelpWindow ('GEOREGION')"
Summary
Dynamic help screens are an excellent use of a temporary Java-Script window. Application users can quickly and easily get the information they need, close the window with little fuss, and return to exactly where they left off. This is especially beneficial on forms, where taking users away can cause problems and confusion.

More Stories By Randy Smith

Randy L. Smith is president/CEO of Midwest Computer Programming and Internet (www.mcpi.com), an Internet/intranet database solution provider based in Hudson, Wisconsin. He has been developing large-scale, Web-based applications for businesses and nonprofits of all sizes, as well as state and federal entities, since 1993. Randy has been working in the computer industry since 1978, and with ColdFusion since 1996.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


IoT & Smart Cities Stories
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Digital Transformation is much more than a buzzword. The radical shift to digital mechanisms for almost every process is evident across all industries and verticals. This is often especially true in financial services, where the legacy environment is many times unable to keep up with the rapidly shifting demands of the consumer. The constant pressure to provide complete, omnichannel delivery of customer-facing solutions to meet both regulatory and customer demands is putting enormous pressure on...
IoT is rapidly becoming mainstream as more and more investments are made into the platforms and technology. As this movement continues to expand and gain momentum it creates a massive wall of noise that can be difficult to sift through. Unfortunately, this inevitably makes IoT less approachable for people to get started with and can hamper efforts to integrate this key technology into your own portfolio. There are so many connected products already in place today with many hundreds more on the h...
The standardization of container runtimes and images has sparked the creation of an almost overwhelming number of new open source projects that build on and otherwise work with these specifications. Of course, there's Kubernetes, which orchestrates and manages collections of containers. It was one of the first and best-known examples of projects that make containers truly useful for production use. However, more recently, the container ecosystem has truly exploded. A service mesh like Istio addr...
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
Charles Araujo is an industry analyst, internationally recognized authority on the Digital Enterprise and author of The Quantum Age of IT: Why Everything You Know About IT is About to Change. As Principal Analyst with Intellyx, he writes, speaks and advises organizations on how to navigate through this time of disruption. He is also the founder of The Institute for Digital Transformation and a sought after keynote speaker. He has been a regular contributor to both InformationWeek and CIO Insight...
Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
To Really Work for Enterprises, MultiCloud Adoption Requires Far Better and Inclusive Cloud Monitoring and Cost Management … But How? Overwhelmingly, even as enterprises have adopted cloud computing and are expanding to multi-cloud computing, IT leaders remain concerned about how to monitor, manage and control costs across hybrid and multi-cloud deployments. It’s clear that traditional IT monitoring and management approaches, designed after all for on-premises data centers, are falling short in ...
In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...
Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...