2 Replies Latest reply on Apr 29, 2010 8:18 AM by lgweb

    Rich:Jquery Problem

    lgweb

      Good evening everybody I am having problems with using rich: jQuery in my application,
      I have added resources on my page as follows:

      <a4j:loadScript src="/js/jquery-1.4.2.js" id="JQ" />
      <a4j:loadScript src="/js/jquery.maskedinput-1.2.2.js" id="MK" />

      And I'm using as follows in my inputs:
      <H: inputText value = "# () buscaAvancada.dataCriacaoFinal"
      id = "fl_ouvDataCriacaoFim" size = "10">
      <f:convertDateTime pattern="dd/MM/yyyy" />
      <Rich: jQuery selector = "fl_ouvDataCriacaoFim"
      query = "mask ('99 / 99/9999 ')" timing = "onload" />
      </ H: inputText>

      Inside my site and have it to try to avoid conflict with prototype:
      <ui:define name="pesquisa">
      <a4j:keepAlive beanName="buscaAvancada" ajaxOnly="true" />
      <div id="pastas"> <img src ="../ images/ouvidoria2_16.jpg "
      align = "left" /> <a href="listagemProtocoloUI.jsf"> <img
      src ="../ images/ouvidoria2_17.jpg "align =" left "border =" 0 "
      alt = "Search Service" title = "Search Service" /> </ a> </ div>
      <a4j:form id="formBuscaAvancada">
      <a4j:loadScript src="/js/jquery-1.4.2.js" id="JQ" />
      <a4j:loadScript src="/js/jquery.maskedinput-1.2.2.js" id="MK" />
      <script type="text/javascript">
           jQuery.noConflict ();
           / / Use Prototype with $(...), etc.
           $ ('SomeId'.) Hide ();
        </ Script>
      ...
      ...
      ...

      But got the following errors in my FireBug:


      element.attachEvent is not a function
      [Break on this error] return (getDOMEventName: getDOMEventName ... ment.attachEvent ("on" + name, wrapper);)
      3_3_2 .... ipt.jsf (line 260)
      $ ("SomeId") is null
      [Break on this error] $ ('SomeId'.) Hide ();
      buscaAvancada.jsf (line 55)

      Carries a mask while the other mascaras JQuery that has no bearing on the page.
      My version of RichFaces is: RichFaces-impl-3.3.2.SR1.jar
      How can I fix this?
      Thank you.

        • 1. Re: Rich:Jquery Problem
          mpickell

          Not sure if i am answering your question, but i see a couple things:

           

          1. your jquery selector should be "#fl_ouvDataCriacaoFim" -- you need the '#' to target an ID
          2. yout jquery tag is inside the inputText tag -- put it outside the inputText tag.  i'm not sure if it is legal inside like that, but it is its own thing.. not part of the inputText

           

          hope that helps.

          • 2. Re: Rich:Jquery Problem
            lgweb

            Thanks for the tips was missing the # before the id put the script

            <head>

            </style>
            <script >
            /* <![CDATA[ */             
                            var $jq = jQuery.noConflict();
                    /* ]]> */  
                   

            </script>
                  
            </head>

             

             

             


            td in the head and ran.
            Problem solved.