8 Replies Latest reply on Nov 25, 2008 6:55 AM by Fausto Morenzoni

    suggestionBox works on Firefox, but not IE

    Martin Schrodt Newbie

      Hi,

      I implemented a relatively straight forward use case of the suggestion box:

      ...
      <body>
       <h:form>
       <h:inputText id="rolesuggest" />
       <rich:suggestionbox for="rolesuggest" suggestionAction="#{authenticator.autocompleteRoles}" var="item" minChars="4" ajaxSingle="false">
       <h:column>#{item}</h:column>
       </rich:suggestionbox>
       <a4j:status startText="Progress" stopText="Done"/>
       </h:form>
      </body>
      ...


      authenticator.autoCompleteRoles(Object) returns a List type object. This works fine on Firefox (3.0.1), but won't on IE 7. On Firefox, after entering 4 chars, the status indicator says "Progress", and shortly after that "Done", with the suggestion box showing. On IE, after 4 chars, the indicator shows "Progress", and stays like this forever.
      From what I see in the server.log, there is a request to the server, but the method authenticator.autoCompleteRoles(Object) is not called. Maybe someone can push me in the direction of where to look further? Of course, I can give more information if needed.

      (Richfaces 3.2.2.GA with Seam 2.0.1.GA on JBoss 4.2.1.GA)


        • 1. Re: suggestionBox works on Firefox, but not IE
          Martin Schrodt Newbie

          Ok, I have an update. I noticed that IE 7 would not succeed in any Ajax-Request, so I put a a4j:log component in, and this is what I get:

          ...
          debug[9:31:46,685]: Reqest end with state 4
          debug[9:31:46,685]: Response with content-type: text/html;charset=ISO-8859-1
          debug[9:31:46,685]: Full response content: [REMOVED]
          debug[9:31:46,685]: Header Ajax-Response not found, search in <meta>
          debug[9:31:46,685]: Header Ajax-Expired not found, search in <meta>
          warn[9:31:46,685]: No ajax response header
          debug[9:31:46,685]: Header Location not found, search in <meta>
          debug[9:31:46,685]: replace all page content with response
          debug[9:31:46,685]: setup custom document.open method
          debug[9:31:46,700]: exception during write page content undefined
          error[9:31:46,716]: Error parsing responseXML Parsing Error: DTD ist nicht zulaessig.
          Location: Line Number 2, Column 11:
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
          -----------^
          debug[9:31:46,716]: page content has been replaced


          There are 2 things that are different than in Firefox: It says it did not find an ajax response header (why is that?), and then fails to accept the document's DTD.
          If I remove the doctype declaration completely, the request seems to go through, however, it does not show the suggestion box, but removes all content from the page, so I am left there with a completely empty page, so I even cannot look at the a4j:log-output :( That's probably because of the inability to find the ajax response header?

          • 2. Re: suggestionBox works on Firefox, but not IE
            Martin Schrodt Newbie

            And I dug a little deeper:
            I now tried richfaces 3.3.0-SNAPSHOT from 17.10.2008, and richfaces 3.1.6.GA, all giving the same result. If I remove the doctype declaration, I see the a4j:log output for a split-second, and then I have an empty page -- IE shows me it had a javascript error ("Type mismatch", line 85, char 452, you gotta love IE's error messages!). When putting the doctype in, I get the "me no want this doctype"-error.

            I tried to configure different a4j-filters (NEKO, TIDY), but somehow the results are always the same. I use richfaces with Seam 2.0.1.GA, do I have to configure filters differently in this case?
            I did it with:

            <context-param>
             <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
             <param-value>TIDY</param-value>
            </context-param>

            No difference if I put NEKO there...
            Oh my, this stuff leaves me disheartened.

            • 3. Re: suggestionBox works on Firefox, but not IE
              Nick Belaevski Master

              Hi,

              That usually happens if ui:composition tag is missing so that included pages bring repeated DTDs into view.

              • 4. Re: suggestionBox works on Firefox, but not IE
                Martin Schrodt Newbie

                Hi nbelaevski,

                thanks a lot for your answer.
                However, in my testcase there are no composition tags, I intentionally stripped it down to the bare minimum. The test.xhtml file looks like this:

                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:s="http://jboss.com/products/seam/taglib"
                 xmlns:rich="http://richfaces.org/rich"
                 xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
                 <head>
                 <meta http-equiv="Content-Type"
                 content="text/html; charset=UTF-8" />
                 <title>Audi</title>
                 </head>
                 <body>
                 <h:form>
                 <h:inputText id="rolesuggest" value="#{authenticator.roleToAdd}" />
                 <rich:suggestionbox for="rolesuggest" suggestionAction="#{authenticator.autocompleteRoles}" var="item" minChars="4" ajaxSingle="false">
                 <h:column>#{item}</h:column>
                 </rich:suggestionbox>
                 <a4j:status startText="Progress" stopText="Done"/>
                 </h:form>
                 <hr/>
                 <a4j:log level="ALL" popup="false" width="800" height="500"/>
                 </body>
                </html>

                With this, the a4j:log says, that IE didn't like the doctype (DTD was not allowed). If I remove the doctype definition, the request completes, but the page I get is all empty. I have this weird behaviour not only with the suggestionbox, but with other ajax-calls as well. They all don't work correctly on IE. I just noticed that the detected content encoding is iso8859, would that be problematic if I send UTF-8?

                • 5. Re: suggestionBox works on Firefox, but not IE
                  Martin Schrodt Newbie

                  I noticed some other WEIRD behaviour:

                  a4j:log from Firefox:

                  debug[12:08:53,663]: Start XmlHttpRequest
                  debug[12:08:53,664]: Reqest state : 1
                  debug[12:08:53,664]: QueryString: AJAXREQUEST=_viewRoot&j_id2=j_id2&j_id2%3Arolesuggest=aaaa&j_id2%3Aj_id3_selection=&javax.faces.ViewState=j_id3&j_id2%3Aj_id3=j_id2%3Aj_id3&inputvalue=aaaa&
                  debug[12:08:53,673]: Reqest state : 1
                  debug[12:08:55,967]: Reqest state : 2
                  debug[12:08:55,968]: Reqest state : 3
                  debug[12:08:55,969]: Reqest state : 4
                  debug[12:08:55,969]: Reqest end with state 4
                  debug[12:08:55,969]: Response with content-type: text/xml;charset=UTF-8
                  debug[12:08:55,970]: Full response content: (removed)


                  a4j:log from IE 7:
                  debug[12:21:33,960]: Start XmlHttpRequest
                  debug[12:21:33,960]: Reqest state : 1
                  debug[12:21:33,975]: QueryString: AJAXREQUEST=_viewRoot&j_id2=j_id2&j_id2%3Arolesuggest=aaaa&j_id2%3Aj_id3_selection=&javax.faces.ViewState=j_id3&j_id2%3Aj_id3=j_id2%3Aj_id3&inputvalue=aaaa&
                  debug[12:21:34,084]: Reqest state : 2
                  debug[12:21:34,084]: Reqest state : 3
                  debug[12:21:34,084]: Reqest state : 4
                  debug[12:21:34,084]: Reqest end with state 4
                  debug[12:21:34,084]: Response with content-type: text/html;charset=UTF-8
                  debug[12:21:34,084]: Full response content: (removed)


                  The content type of what get's sent back to IE is text/html, while Firefox gets text/xml. Also, the full response content that I see differs a lot. While the context in Firefox looks like it is only a "difference", meaning it only shows elements to update, the content in IE looks like it a normal non ajax-response. Also the action method is not called during the IE request. So it seems like something on the server side doesn't recognize the request as an ajax request?

                  • 6. Re: suggestionBox works on Firefox, but not IE
                    Nick Belaevski Master

                    I've tried your code, works fine for me. I guess that this is Seam forwarding to another page due to error. Can you please try to use not an authentificator component but a specially created bean?

                    • 7. Re: suggestionBox works on Firefox, but not IE
                      Fausto Morenzoni Newbie

                      Hi Spheenik,

                      we have the same problem, did you find out how to solve it?

                      Thank you in advance for any help/suggestion,
                      Fausto

                      • 8. Re: suggestionBox works on Firefox, but not IE
                        Fausto Morenzoni Newbie

                        Solved: we had 2 nested h:form tags, simply removed the internal one and now the suggestion box is working on internet explorer, too.