RichFaces 3.1.0: IE 6 JavaScript errors after successful AJ
melvinhil Sep 18, 2007 12:34 PMAfter upgrading to 3.1.0 and retesting everything, I'm getting an interesting scripting error in IE6:
Line: 1485
Error: Object doesn't support this property or method
Note that I have the org.ajax4jsf.COMPRESS_SCRIPT parameter set to false in my web.xml....
The error actually seems to occur on line 1476 of the a4j_3_1_0org.ajax4jsf.javascript.AjaxScript resource. The JavaScript code on that line is:
window.document.write(req.getResponseText());
In the Script debugger I can see that the req object has a valid responseText field, so I'm wondering if the window.document.write call is related to the problem.
Here's my JSF - the commandButton I'm clicking is in bold:
<a4j:region id="reg1"> ... a separate form here with is own AJAX requests that reRender elements in reg2... </a4j:region> <a4j:region id="reg2"> <rich:panel id="personResultPanel"> <h:panelGrid id="personResultGrid" columns="2"> <h:panelGrid id="formPanel" columns="1" rendered="#{addRoomOccupant.personResults != null}"> <h:selectOneMenu id="personResultBox" value="#{addRoomOccupant.personId}" validator="#{addRoomOccupant.validateAssignment}"> <f:selectItems value="#{addRoomOccupant.personResults}" /> </h:selectOneMenu> <h:panelGrid id="buttonMsgGrid" columns="2" style="width:100%" columnClasses="left, right"> <a4j:commandButton id="saveButton" action="#{addRoomOccupant.savePersonAssignment}" value="Save" type="button"/> <h:messages id="errors" style="color:red;font-weight:bold" /> </h:panelGrid> </h:panelGrid> </h:panelGrid> </rich:panel> </a4j:region>
The request executes successfully, all updates are performed and the application is successfully invoked. I even get the correct response -- it's just accompanied by the JS error mentioned above.
Here's a4j Logger output for the entire request:
debug[9:50:13,456]: Start XmlHttpRequest debug[9:50:13,456]: Reqest state : 1 debug[9:50:13,471]: QueryString: AJAXREQUEST=addEmpForm%3Areg2&addEmpForm%3Alname=leish&addEmpForm%3Afname=&addEmpForm%3ApersonResultBox=45232&addEmpForm=addEmpForm&addEmpForm%3AsaveButton=addEmpForm%3AsaveButton& debug[9:50:13,893]: Reqest state : 2 debug[9:50:13,893]: Reqest state : 3 debug[9:50:13,909]: Reqest state : 4 debug[9:50:13,925]: Reqest end with state 4 debug[9:50:13,925]: Response with content-type: text/html; charset=ISO-8859-1debug[9:50:13,925]: Full response content: ... correctly rendered content from the action's success outcome... debug[9:50:13,940]: Header Ajax-Response not found, search in <meta> debug[9:50:13,956]: Header Ajax-Expired not found, search in <meta> warn[9:50:13,956]: No ajax response header debug[9:50:13,971]: Header Location not found, search in <meta> debug[9:50:13,987]: replace all page content with response debug[9:50:13,987]: setup custom document.open method debug[9:50:14,003]: call selectSingleNode for id= org.ajax4jsf.oncomplete debug[9:50:14,034]: window.document has opened for writing
This output seems to support my theory that something's wrong with the window.document.write call, given that the last line in the log is the one immediately preceding that call. After that call, the logger quits working, and I get the IE error shown above. Furthermore, the response shown in the call is the correctly rendered response for the success outcome I was looking for.
Any ideas what I'm doing wrong here?
Thanks!!!