Joerg
Joerg

Reputation: 914

TypeError: element.selectNodes is not a function at Object.A4J.AJAX.XMLHttpRequest.getElementsByTagName

I have to maintain an existing enterprise web application which is based on JSF 1.1 and Ajax4JSF. I want to add an asynchronous standard validation to an existing input field using <a4j:support>. It boils down to the below code snippet:

<%@ page contentType="text/html; charset=ISO-8859-1" %>
<%@ taglib uri="http://java.sun.com/jsf/html"                   prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core"                   prefix="f"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax"             prefix="a4j"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Validate Test</title>
</head>
<body>
<f:view>
       <h:form>
            <h:inputText value="42" id="fooInput" required="true">
                <a4j:support event="onchange" reRender="fooMsg" immediate="true" ajaxSingle="true"/>
                <f:validateDoubleRange minimum="10" maximum="500"/>
            </h:inputText>
            <h:message for="fooInput" id="fooMsg" style="color: red;"/><br/>
            <h:inputText value="Bar" id="barInput">
            </h:inputText>
        </h:form>
</f:view>
</body>
</html>

But the Ajax request is not fired. The following JS error is thrown:

TypeError: element.selectNodes is not a function 
    at Object.A4J.AJAX.XMLHttpRequest.getElementsByTagName (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:32:19)
    at Object.A4J.AJAX.XMLHttpRequest._appendNewElements (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:43:389)
    at Object.A4J.AJAX.XMLHttpRequest.appendNewHeadElements (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:43:185) 
    at Object.A4J.AJAX.processResponse [as onready] (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:57:731) 
    at XMLHttpRequest._request.onreadystatechange (https://localhost/MyFooApp/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf:20:25)

I have also tried to change both the "immediate" and the "ajaxSingle" attribute, but it did not change anything. The Ajax request does not get fired. Other Ajax4JSF features in the web application seem to work. What is the problem is and how can I solve it?

Upvotes: 0

Views: 329

Answers (0)

Related Questions