0 Replies Latest reply on Jul 2, 2010 6:07 AM by petrak

    Problem with h:commandLink and IE

    petrak

      Hello all,
      I have h:commandLinks in my jsf-page that call a method from my bean and on return render a different part of the page with new parameters. Some of these links also submit a value to the bean from a ui:param or a4j:repeat with this function call.
      All works well, except in IE (8) where the links do nothing except jump back to the top of the page.

       

      My jsf is included in a standard html page (with company design and menus) and my team and I have traced this error to a div with id="k" contained in this html page.
      If I remove that div or change the id, the links work fine in every browser.

       

      As workarounds I have tried the following:
      1. Use s:link instead of h:commandLink. Works fine for most links except the ones where I have to submit the a4j:repeat value within the function. s:link simply ignores the value.
      2. Use s:link and submit the repeat-value via a f:param. This works, but switching to this solution means a whole lot of (unnecessary?) work for my team and me, since all of our programming work is affected by this.
      3. Change the id of the div. This works and for development we are currently doing so. But for production this is not a workable solution, since the html pages are templates provided by a content management system and there are hundreds if not thousands of different templates that would have to be changed.

       

      So, does anyone know why this <div id="k"> is messing with my commandLinks in IE and what we can do about that?

       

      My jsf-page (or at least the relevant part) looks like this.
      <h:form id="SearchFormSimpleTop">
          <h:outputLabel>#{SearchBean.msg("searchQueryLabelText")}</h:outputLabel><br />
          <h:inputText size="40" value="#{SearchBean.q}" />
          <div>
              <ui:param name="offset" value="#{SearchBean.currentPage}" />
              <h:commandButton id="thisOneButtonSubmitSimple" action="#{SearchBean.returnSubmit(true,true,0,'r')}" />
              <ul><li>
              <h:commandLink action="#{SearchBean.returnSubmit(false,true,offset,'i')}">

                  #{SearchBean.msg("searchQueryExtendedButton")}
              </h:commandLink>
              </li></ul>
          </div>
      </h:form>

       

      The same inner <ul> looks like this in the final html-output:
      <ul><li>
          <script type="text/javascript" language="Javascript">function dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++) {f.removeChild(adp[i]);}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var i = 0;for (k in pvp) {var p = document.createElement("input");p.type = "hidden";p.name = k;p.value = pvp[k];f.appendChild(p);adp[i++] = p;}};function jsfcljs(f, pvp, t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target = ft;dpf(f);};</script>

          <a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('_jbpns_2fmiro_2dstap_2fSuche_2fWWUSuchePortletWindowsnpbj:_viewRoot:SearchFormSimpleTop'),{'_jbpns_2fmiro_2dstap_2fSuche_2fWWUSuchePortletWindowsnpbj:_viewRoot:SearchFormSimpleTop:j_id13':'_jbpns_2fmiro_2dstap_2fSuche_2fWWUSuchePortletWindowsnpbj:_viewRoot:SearchFormSimpleTop:j_id13'},'');}return false">Erweiterte Suche</a>
      </li></ul>

       

      IE's debugger tells me that the problem lies within the JavaScript created by richfaces for my h:commandLink. Specifically in the part I've marked bold: "for(k in pvp)".

      Why does this occurr?

       

      My richfaces version is 3.3.3.BETA1
      If you need more details, please let me know.