For some time I have been convinced that there is ghost code in my Xpages applications. Being new to Xpages I often rework my approach to things and it seems as though my old code was still running even though it had definitely been changed !
Another part of this phenomenon is that I have been convinced that onclick events in links have been firing on page load. This usually happened in the early hours adding to my belief that it was a ghost !
Well Keth Strickland made a post a few days ago that made me think it might not be just me. He described how if you edit the onclick property of a link in the “All Properties” tab the code would fire on page load.
Investigating further I found that the problem was two fold. Keith is right, it does fire but it is also possible to end up with two sets of code for the on-click event as the screen cast below shows.
1) Add some code to the on-click of a link via the events tab
2) save the document
3) reopen the document and you see the same code in the all properties tab for the link
4) modify the code via the events tab ( in this case change “2” to “x” )
5) save and close the document
6) re-open the document and you have two different sets of code, one of which also happens to run on page load
I had to make a screen cast to prove I wasn’t mad.