1 Reply Latest reply on Feb 6, 2010 7:19 AM by Nick Belaevski

    Problem with modalPanelBorder.js when using jQuery directly

    Arbi Sookazian Master

      I need to get the element index of the current element.  Apparently this is not possible via JavaScript other than document.activeElement which just gives me something like "HtmlInputText" which is not useful in terms of knowing exactly where the focus currently is.

       

      So I found this jQuery solution:

       

           currentIndex = $(this).parent().prevAll().length;

      But I need to call that from within a JS function. 
      I'm pretty sure I can't use <rich:jQuery> tag to solve this.


      So when I do this:

           <script type="text/javascript" src="${facesContext.externalContext.requestContextPath}/resources/js/jquery-1.4.1.js">

      I get this JS error:

      Webpage error details

      User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)
      Timestamp: Fri, 5 Feb 2010 22:42:59 UTC


      Message: 'style' is null or not an object
      Line: 7
      Char: 3
      Code: 0
      URI: http://localhost:8080/cis/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/modalPanelBorders.js

      I am using this solution so I can skip certain non-input elements (<span>, <div>) when user tabs into them.  Once I know the current element's
      position, I will find the next inputtable elelement's position and set the focus there.
        We are basically avoiding the setting of focus
      on rich:togglePanel components as the user tabs thru the input fields in the form.