4 Replies Latest reply on Dec 2, 2009 7:06 AM by Ilya Shaikovsky

    Problem attaching action to h:commandLink in Firefox

    Greg Noe Newbie

      Hi All,

      I'm using the a4j:repeat tag to create a list of h:commandLink links. Each link generated also has an a4j:actionparam assigned to it. All of the links use the same action. I am restricted to using h:commandLink because the action I'm using returns a .pdf to the page. (I have tried other actions and have the same problem).

      The problem that I'm having is that when the page loads in Firefox, the links act as if they don't have an action assigned to them. When the links are clicked, the page scrolls to the top of the page and the # character is appended to the page URL.

      If I refresh (F5) the page, the action gets attached and the links start to work.

      I don't get any errors in my Tomcat console.
      In Firebug I get the following error:

      f is undefined
      apf(Object name=f, "...alertIncludeForm:j_id208:2:alertLink,alertId,8ae5810224839ba50124839baa36000d")8 (line 2)
      jsfcljs(Object name=f, "...alertIncludeForm:j_id208:2:alertLink,alertIncludeForm:j_id208:2:alertLink,alertId,8ae5810224839ba50124839baa36000d", Object name=t)8 (line 2)
      function onclick(event) {
       if (typeof jsfcljs == "function") {
       jsfcljs(document.forms['alertIncludeForm'], "alertIncludeForm:j_id208:2:alertLink,alertIncludeForm:j_id208:2:alertLink,alertId,8ae5810224839ba50124839baa36000d", ""); }
       return false; }
      (click clientX=762, clientY=491)
      


      I do not have this problem in IE, Chrome or Opera.

      <rich:panel>
       <f:facet name="header">
       <h:outputText value="#{msgs.alert_header}" />
       </f:facet>
      
       <h:form id="alertForm" >
      
       <rich:messages ajaxRendered="true" id="msgContainer">
       <f:facet name="errorMarker">
       <h:graphicImage value="/icons/exclamation.png" />
       </f:facet>
       </rich:messages>
      
       <a4j:repeat value="#{alertController.alertList}" var="a">
       <h4>
       <h:outputText value="#{a.publicationStartDate}" >
       <f:convertDateTime pattern="MM-dd-yyyy"/>
       </h:outputText>
       </h4>
       <p>
       <h:commandLink action="#{alertController.getAlertPdfAction}" value="#{a.publicationTitle}" id="alertLink" type="submit">
       <a4j:actionparam id="alertIdParam" name="alertId" assignTo="#{alertController.selectedAlertId}" value="#{a.publicationData.id}"/>
       </h:commandLink>
       </p>
       </a4j:repeat>
       <p>
       <h:graphicImage value="/icons/AcrobatReader16x16.png" style="margin-right:5px;cursor:pointer;" onclick="var acroWin = window.open('#{msgs.risk_alert_get_acrobat_link}','');acroWin.focus();"/><a4j:commandLink action="#" value="#{msgs.risk_alert_get_acrobat_text}" onclick="var acroWin = window.open('#{msgs.risk_alert_get_acrobat_link}','');acroWin.focus();"/>
       </p>
       </h:form>
      </rich:panel>
      


      I've tried just everything I can think of. Can anybody help?

      Also, this may not be a RichFaces problem, but does anybody know how to prevent JSF/RichFaces/whatever from adding unwanted line break tags from before and after an HTML list element? I've tried the CSS approach of setting the top and bottom margins of list elements to 0px (also directly through the style attribute), but JSF/Richfaces/whatever just ignores it.