3 Replies Latest reply on Jun 18, 2011 9:00 PM by Nick Belaevski

    call rich:jquery from another js function

    ginc Newbie



      Recently I had to implement some new javascript functions into my app. The problem that i was facing afterwards; how does the user recognize changes made to the website?! Well, in specific the value of an h:inputText changes, so I thought I just highlight the box to advise the user of the changes made.


      So far so good, the following code works fine:


      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          <script type="text/javascript" language="JavaScript" src="js/jquery-1.6.1.js"></script>
          <script type="text/javascript" language="JavaScript" src="js/jquery.color.js"></script>
          <script type="text/javascript">
              function test()
                  $('#main_form\\:user_input').animate({ backgroundColor: "#ffff33"}, 500).
                          animate({ backgroundColor: "#ffffff"}, 500).
                          animate({ backgroundColor: "#ffff33"}, 500).
                          animate({ backgroundColor: "#ffffff"}, 500);
      <div id="clickme" onclick="test()">
          Click here
      <input id="main_form:user_input" size="50" value="test" />


      As soon as I click on the 'clickme' div, the function 'test' executes the effect.


      Now I tried to implement it into richfaces 4, but i failed.


      Here is what I did:


      <rich:jQuery timing="onJScall" name="highlightUserInput" selector="#user_input"
                       query="animate({ backgroundColor: '#ffff33'}, 500).animate({ backgroundColor: '#ffffff'}, 500).animate({ backgroundColor: '#ffff33'}, 500).animate({ backgroundColor: '#ffffff'}, 500);"/>


      then i tried to call it:



      function test()
       var input_box = document.getElementById('main_form:user_input');


      and here is the inputbox which should show the effect:


      <h:inputText id="user_input"
                                           autocomplete="off" />


      when i try to execute this, I'll get the following error:


      Cannot convert onJScall of type class java.lang.String to class org.richfaces.component.JQueryTiming


      After some googling i found a chat history saying that the value 'onJScall' does not exist anymore..


      Does somebody have a solution for this or can direct me to a page where the rich:jquery behavior is well described?