Wondering if anyone has a work around for this...

The tomahawk popup (1.1.2) is not AJAX friendly, at least not AjaxAnywhere friendly.

The popup creates the following _javascript_ in the renderer:
        String popupId = _javascript_Utils.getValidJavascriptName(clientId+"Popup",false);

        ResponseWriter writer = context.getResponseWriter();
        writer.startElement(HTML.SCRIPT_ELEM, uiComponent);
        writer.writeAttribute (HTML.SCRIPT_TYPE_ATTR,HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT,null);
        writer.writeText("var "+popupId+"=new orgApacheMyfacesPopup('"+clientId+"',"+
                (displayAtDistanceX==null?-5: displayAtDistanceX.intValue())+","+
                (displayAtDistanceY==null?-5:displayAtDistanceY.intValue())+");",null);
        writer.endElement(HTML.SCRIPT_ELEM);

As you can see, it uses the "var" syntax. To get _javascript_ to load, AjaxAnywhere will execute an eval on the _javascript_ contents. As a result, this variable will immediately lose scope and not be available to code on the page.

If it was "window[" + popupId + "]" = new ..." it would bind the _javascript_ variable to the window (the recommended method of having a global variable).

Has anyone come across this, and if so, found a workaround?

-Andrew

Reply via email to