Using Javascript in a Lotus Notes Client app

For this tip, I’m talking about JavaScript in the Notes Client. JavaScript has been available to the Notes Client since R5. R5 and R6 both use Version 1.3. (Question: what about R7?) One thing to be aware of is that with R6, the javascript “attaches” differently to the object, so you can’t develop in R6 designer and run in R5 Client).

In this case I had a request to add a “Check All” action to act on a check box field. I was thinking I would need to get the get the field values in LotusScript, change the values, and then refresh the uidocument … till I remembered “JavaScript”!

Always use the right Tool for the job at hand. So I was able to quickly add a button and add the following script, given that I had a check box field called – what else – “Checkbox” :

1
2
for (i = 0; i < document.forms[0].Checkbox.length; i++)
    document.forms[0].Checkbox[i].checked = true ;

and I also created a “Uncheck” button like this :

1
2
for (i = 0; i < document.forms[0].Checkbox.length; i++)
    document.forms[0].Checkbox[i].checked = false ;

For those unfamiliar with JavaScript a word of caution, it is very, very, case sensitive; Field names must be exactly right.

JavaScript provides a great way to do UI work, whether on the Web or with in your Notes Client. Yet another tool in the kit of your Lotus Notes Developer.

One Reply to “Using Javascript in a Lotus Notes Client app”

  1. I am trying to use Javascript in the notes client. I am trying to get an element by ID but its not working. Its almost like the notes client does not recognise this javascript command. There is nothing wrong with my syntax as it works on the web. If this command does not work in the notes client , is there an equivalent that works in the notes client ?

Leave a Reply