SNTT : XPages onclick Ghosts in the machine

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.

Getting OneUi V2.01 to work with Internet Explorer 6

I have been struggling to get an XPage application to work well with Internet Explorer 6 using the OneUIV2 style sheet. There is some useful documentation from IBM which explains that the IE6 CSS hacks are done differently in this V2 of OneUI.

The answer is to add this code to your xpage. In my case I added it to a banner custom control using a computed field

<xp:text escape=”false” id=”CSS_Hack”><xp:this.value><![CDATA[${javascript:”<!–[if IE 6]><script type=”text/javascript”>document.getElementsByTagName(“html”)[0].className+=” lotusui_ie lotusui_ie6″;</script><![endif]–><!–[if IE 7]><script type=”text/javascript”>document.getElementsByTagName(“html”)[0].className+=” lotusui_ie lotusui_ie7″;</script><![endif]–><!– END exampleHead.htm –>” }]]></xp:this.value></xp:text>

Hope this helps someone else who has been pulling their hair out with ie6.

p.s. you can also use the following SSJS to detect ie6

if (context.getUserAgent().isIE(0,6)) {
// do something like suggest a better browser