Question

I cannot manage to make asmall piece of javascript working in a lotus notes 6.5 email. I'm building a html, send it by mail as a html, and inside I would like to have some links to hide/show a few div. I try to use document.getElementById but when I click on the link I have the following error:

"document.getElementById is not a function".

I'm thinking using a document.getElementById(id).style.display='none'; to hide it (if I can manage the div).

Any ideas how to show/hide my div?

Was it helpful?

Solution

The HTML engine in Lotus Notes is not anything like you'd get in a browser. I'm fairly certain the error message is correct when it says "document.getElementById is not a function" - there is little to no support for javascript in Notes emails.

If you need to have something hide/show in Notes, you will have to create a Notes form with actions and hide formulas to get the same effect. Then emails can be sent with the form embedded into the email, and when received the email will open that form instead of a typical memo form.

Note, it is unlikely most email clients (Outlook, etc) will support javascript due to the security holes it would open. You might have better luck sending a link to users and then having them open up a Web page or Notes database where you have more control over how things are presented to them.

OTHER TIPS

The root of the problem is that Notes doesn't display HTML*. In order to display an HTML-formatted MIME email (or any other rich text field whose contents are stored as MIME and HTML), the content must first be converted to Notes Rich Text (composite data, or CD) format. The conversion of static HTML has improved a lot over the years, but once the conversion is completed, there is no HTML document to modify. Obviously, your link/action was properly translated to its Notes equivalent, but there are no hooks for DOM methods in the Notes client. JavaScript is pretty much restricted to manipulating field values (through the document.forms[0].LiteralFieldName method of access), swapping images (through the document.images collection) and a small subset of the window object's methods.

*One can view pure web pages in the Notes client, but that uses the IE ActiveX control in the full tab -- it's not available natively for rendering a part of a document.

it may not fit your HTML needs but might help you hide / show content:

  • In a new mail, select the content you want to hide / show
  • Click on Create / Section
  • You can also define a name for this section within section's properties

(works in Lotus Notes 8.5)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top