You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gaetan Zoritchak <g....@moncoachfinance.com> on 2011/11/29 15:45:47 UTC

Access Denied with AjaxEditableLabel ant AjaxEditableMultiLineLabel under chrome and safari #wicket1.5

I had this problem during the migration from wicket 1.4 to wicket 1.5


The problems occurs under chrome, safari and wicket 1.5

Scenario with an AjaxEditableMultiLineLabel :

1. The user puts the focus on the AjaxEditableMultiLineLabel and edit the
field.
2. Without focusing out of the editable label, the user clicks on another
tab of chrome.
=> coming back to the first tab, the browser shows an "Access Denied Page".

The log shows the warn :
WARN - RequestListenerInterface - behavior not enabled; ignore call.
Behavior
org.apache.wicket.extensions.ajax.markup.html.AjaxEditableMultiLineLabel$5@18fa85at
component [ [Component id = editor]]

At that time, Martin proposed me a first workaround :
http://markmail.org/message/uyjns2njjpo22xoj#query:+page:1+mid:laq7whb4urciyz6n+state:results

The problem appeared again because of my migration to wicket 1.5.3.

I tried to further analyze the problem. It seems that the AJAX call is
done 2 times.
When the user switches tabs chrome, the updating of the html triggers
another onblur event and a new ajax call:

Wicket.replaceOuterHtmlSafari = function(element, text) {
// if we are replacing a single <script> element
if (element.tagName == "SCRIPT") {
 // create temporal div and add script as inner HTML
var tempDiv = document.createElement("div");
 tempDiv.innerHTML = text;

// try to get script content
var script = tempDiv.childNodes[0].innerHTML;
 if (typeof(script) != "string") {
script = tempDiv.childNodes[0].text;
 }
 element.outerHTML = text; <==== Trigger another blur event when the user
has already changed of tab.
 try {
eval(script);
} catch (e) {
 Wicket.Log.error("Wicket.replaceOuterHtmlSafari: " + e + ": eval -> " +
script);
}
 return;
}...

As I'm not a javascript expert, does anybody know how to correct the
problem in javascript instead of using a workaround?

Thanks,
Gaetan,