6 Replies Latest reply on Dec 5, 2007 7:36 AM by sergiokd

    Firefox problem when using a4j:jsFunction

    ccsilva

      Hi,

      I am using JSF, A4J, RichFaces and Facelets.

      I have the code:

      <a4j:form>
       <a4j:jsFunction name="myJS" reRender="panelSubMenu,panelBody" action="#{siteHelperBean.abrirPagina}">
       <a4j:actionparam name="id" assignTo="#{siteHelperBean.id}" />
       </a4j:jsFunction>
      </a4j:form>
      


      This code generated a perfect JavaScript when I am using IE7, but when I use the Firefox I have a problem. See below:

      IE7 generated code

      <form id="j_id4" name="j_id4" method="post" action="/atual/site/index.faces"><script id="j_id4:j_id5" type="text/javascript">
      <!--
       //<![CDATA[
       function myJS(id){A4J.AJAX.Submit('_viewRoot','j_id4',null,{'parameters':{'id':id,'j_id4:j_id5':'j_id4:j_id5'} ,'actionUrl':'/atual/site/index.faces'} )};
       //]]>
      //-->
      </script>
      


      Firefox generated code

      <form id="j_id4" name="j_id4" method="post" action="/atual/site/index.faces"><script id="j_id4:j_id5" type="text/javascript">
       //<![CDATA[
       //<![CDATA[
       function myJS(id){A4J.AJAX.Submit('_viewRoot','j_id4',null,{'parameters':{'id':id,'j_id4:j_id5':'j_id4:j_id5'} ,'actionUrl':'/atual/site/index.faces'} )};
       //]]>
       //]]>
      </script>
      


      If you see the code above, you will see the a duplicated code (//<![CDATA[ and //]]>). This occurs just when I open the page with Firefox.

      Someone can help me?

      Thanks!!!

      Claudiney
      Programmer, Brazil

        • 1. Re: Firefox problem when using a4j:jsFunction

          Check the latest version of JSF RI and facelets.

          JSF RI used to have such problem several versions ago.

          Probably, <f:view contentType="text/html"> somewhere on the page might help. I am not sure.

          P.S. FireFox cannot generate it. It is something on the server side.

          • 2. Re: Firefox problem when using a4j:jsFunction
            ccsilva

            Hi SergeySmirnov,

            I just have added the code you suggested and now works perfect!!!

            <f:view contentType="text/html">
            ...
            </f:view>
            


            Thank you very much!!!!

            Claudiney

            • 3. Re: Firefox problem when using a4j:jsFunction
              sergiokd

              I am also facing with a problem on Firefox.
              I have tried this trick of f:view but it did no work.
              In my case the page is not reRendered, and I am using the tag reRender of a4j:jsFunction.

              I have tried
              richfaces-ui-3.1.2.GA, richfaces-ui-3.1.3-SNAPSHOT
              jsf-1.2_04-b16-p02, jsf-1.2_05-b06-FCS

              Also the libs included in the sample for tomcat6 with no success.

              With richfaces-3.0.1 I used not to have any problem.

              • 4. Re: Firefox problem when using a4j:jsFunction
                sergiokd

                using <a4j:log/> on a firefox browser and richfaces-ui-3.1.2.SP1

                debug[15:57:52,625]: NEW AJAX REQUEST !!! with form :perForm
                debug[15:57:52,625]: Append hidden control perForm with value [perForm] and value attribute [perForm]
                debug[15:57:52,625]: Append text control perForm:teste with value [] and value attribute [null]
                debug[15:57:52,625]: Append select-one control perForm:sis with value [] and value attribute [null]
                debug[15:57:52,640]: Append text control perForm:gruDesc with value [] and value attribute [null]
                debug[15:57:52,640]: Append hidden control javax.faces.ViewState with value [_id2] and value attribute [_id2]
                debug[15:57:52,640]: parameter width with value 7
                debug[15:57:52,640]: parameter perForm:j_id22 with value perForm:j_id22
                debug[15:57:52,640]: Start XmlHttpRequest
                debug[15:57:52,640]: Reqest state : 1
                debug[15:57:52,640]: QueryString: AJAXREQUEST=perForm%3AregiaoMemoCad&perForm=perForm&perForm%3Ateste=&perForm%3Asis=&perForm%3AgruDesc=&javax.faces.ViewState=_id2&width=7&perForm%3Aj_id22=perForm%3Aj_id22&
                debug[15:57:52,656]: Reqest state : 1
                debug[15:57:52,718]: Reqest state : 2
                debug[15:57:52,718]: Reqest state : 4
                debug[15:57:52,718]: Reqest end with state 4
                error[15:57:52,734]: request don't have status code - network problem, Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]
                error[15:57:52,734]: Reqest error, status : 599 Network error
                debug[15:57:52,734]: No parsed XML document in response
                



                • 5. Re: Firefox problem when using a4j:jsFunction
                  ccsilva

                  Hi,

                  Do you have a JS error on Firefox? On IE your code works fine?

                  Paste some code and describe the problem.

                  Bye

                  • 6. Re: Firefox problem when using a4j:jsFunction
                    sergiokd

                    I am not having JS errors, on IE is working just fine.
                    I am using a rich:modalPanel where the user can select a value, by JS I return a code and fire the function defined by.

                     <a4j:jsFunction name="carregaBean" action="#{grupoCadMBean.atualiza}" reRender="painel">
                     <a4j:actionparam name="width" noEscape="true" value="window.id"
                     assignTo="#{grupoCadMBean.grupo.gruId}" />
                     </a4j:jsFunction>
                    
                    


                    The log from IE it is complete different without the lines with errors.