0

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?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Joerg
  • 790
  • 2
  • 10
  • 23
  • What do you mean "would not work"? Speak from the developer's perspective. Does the AJAX event even fire (is there a request?). Do any messages appear in the browser console or server logs? – DavidS Jun 19 '15 at 17:39
  • Thanks for the feedback. I am new to client-side debugging and because I used standard components I couldn't debug in my server-side code and wasn't sure where to look. See my edits above. – Joerg Jun 22 '15 at 07:59
  • Jsf 1.1? Can't you at least try to update to 1.2? – Kukeltje Jun 23 '15 at 16:35
  • No, unfortunately not, due to several dependencies to other libraries. :( – Joerg Jun 25 '15 at 09:11

0 Answers0