Calling A Javascript Routine From A Hotspot

It is amazingly easy to call a JavaScript routine from a text or graphic
hotspot, but you may not find this in any Lotus documentation. This uses the
javascript: psuedo-URL, which is described in the Link Object section of Danny
Goodman's JavaScript Bible. This can also be used to call JavaScript routine's
directly from the location bar for testing purposes also.
1. Declare your Javascript function somewhere near the top of the form (doesn't
have to be in HTMLHead, and the syntax is much easier using pass-thru HTML)
2. Mark your text or graphic area, and select Create...Hotspot...URL link
3. In the URL link box, type (without quotes): "javascript:void

That's it! This works whether or not the database uses the "Use Javascript
when generating pages option".

Example - to have a graphic button (Archive doc) pop up a dialog box to prompt
for a number, set a flag for the WebQuerySave agent, and save the document:

In pass-thru HTML:
function getArchiveNum ()
var ArchiveNum = prompt("Enter the archive number for this document: ", "
if (ArchiveNum != null) {
document.forms[0].ArchiveNum.value = ArchiveNum
document.forms[0].ArchiveNow.value = 1
} else {
alert("The document cannot be archived without an archive number")

In the URL link box for the hotspot:
javascript:void getArchiveNum()

This was first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.