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.

This entry was posted in JavaScript, Lotus Domino, Show-n-Tell+Thursday. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Posted April 1, 2008 at 2:33 am | Permalink

    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 ?

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
  • Follow

  • Archives (since 2003)

  • Categories

  • Recent Posts

  • Twitter Updates

    • I liked a YouTube video -- Recycle your unwanted electronics - City of Toronto http://youtu.be/91OXkMkesBc?a 14 hours ago
    • I'm organizing and coordinating my Japan Trip with Google Wave. Seeing both the promise and the fail. of the product. 19 hours ago
    • I have failed my saving Throw against Shiny ... I new 32G iPod Touch is on order :) 1 day ago
  • del.icio.us links

  • Flickr

    Hanging Gardens of KensingtonHanging Gardens of KensingtonMore Chocolate CakeMore Chocolate Cake
  •  

    April 2006
    M T W T F S S
    « Mar   May »
     12
    3456789
    10111213141516
    17181920212223
    24252627282930
  • Spam Blocked