torsdag 14 april 2011

Xpage Events doesn't always work after partial refresh

I had a strange error today, I had an Xpage that when you clicked in the navigation a partial refresh was done and a "document" was loaded into a panel with a title and some RichText displayed inside a computed text control it also had a Back button that executed some server side SSJS.
On some documents the back button didn't work. I started to investigate.
I found that the javascript at the bottom of the returning partial refresh was never executed.

Something in the richtext HTML did this. But there was nothing wrong in the HTML.
I should also add that the problem only ocurred in IE 8 & 9 with compability mode.

No to the fun part how did I solve the problem.

I created a Div for holding the returning HTML
and below this in the Computed text control, I added a script tag that did a getElementById and assigned the Dokumenttext the tag using innerHTML but to assign the text I had to escape the HTML first in SSJS and then unescape it before I added in to the innerHTML

2 kommentarer:

  1. By any chance, is it related to the following

  2. I think this is some kind of variation of the problem. In this case it's th HTML that breaks trigger of the script that attaches events.