Calling A Javascript Routine From A Hotspot

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
functionname(parameters)"

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:
&LTSCRIPT LANGUAGE="JavaScript">
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
document.forms[0].submit()
} else {
alert("The document cannot be archived

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

without an archive number")
}
}
</script>

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

This was first published in November 2000

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.