I'll use an example to explain. I have a document that users record to track number of items completed (numItems) and total time (time). numItems should be an integer and time should be hh:mm. I have 20 of these on the document and I have totals and other things, but that's beyond the scope of this documentation. Whenever numItems or time is entered, I want to immediately validate the user input, check to see if the other piece is entered, and compute an average time per item. This is easy to do with LotusScript in the Onblur event. But there's a PROBLEM. Onblur is finicky and tends to run more than once (see Notes help), so I tried to trick it to run only once.
option 1: set a flag on the uidoc or with a global variable
I use Onfocus and a "currentField" field to track the field I'm on. I set my Onblur flag to "done" the first time Onblur runs. This works, but Onblur will run exactly once. This is a problem if I never left the field, but want to do some input validation.
option 2: use timer at the very end of my onBlur code to prevent multiple execution with X/100ths of a second
timer is easy to use and returns a single in time elapsed since midnight to the 100ths of a second. Again, I can use the uidoc, or a global variable to track and make sure Onblur doesn't run multiple times within say 25/100ths of a second. This works, but I need to make sure I set the timer at the right time and calculate correctly etc. The 25/100ths of 1 second that I picked is arbitrary and based on my assumption that a fast data entry user won't be able to update and trigger onBlur this quickly. This is certainly not a perfect solution.
It's possible but not clean and simple to make sure Onblur runs only once. Whenver possible, I try to avoid this type of "in-line" processing and validation using the onBlur event.