7 Replies Latest reply on Apr 6, 2007 6:59 AM by Ilya Shaikovsky

    Question about rich:datatable and h:commandLink not working

    Ross H Newbie

      When I click on the commandLinks, nothing happens, the links appear dead, there is a javascript error @ the bottm of the page which says -

      'elements' is null or not an object.

      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
      
      <f:view>
       <html>
       <head>
       <link rel="stylesheet" href="css/corpStyles.css">
       </head>
       <body>
       <rich:tabPanel switchType="client" id="tabs">
       <rich:tab label="Monitor" id="monitorTab">
       <f:subview id="includeSiteMonitor"><jsp:include page ="SiteMonitor.jsp"/></f:subview>
       </rich:tab>
       <rich:tab label="History" id="historyTab">
       <f:subview id="includeHistory"><jsp:include page ="History.jsp"/></f:subview>
       </rich:tab>
       <rich:tab label="Reports" id="reportTab">
       <h:outputText value="Report tab"/>
       </rich:tab>
       <rich:tab label="Administration" id="adminTab">
       <h:form id = "addsiteform"><f:subview id="includeAddSite"><jsp:include page ="AddSite1.jsp"/></f:subview></h:form>
       </rich:tab>
       </rich:tabPanel>
       </body>
       </html>
      </f:view>
      

      AddSite1.jsp:
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
      
      <f:view>
      <h:messages layout="table"/>
      <html>
      <head>
      <link rel="stylesheet" href="css/corpStyles.css">
      </head>
      <body>
      <center>
      <table border=5>
      <tr><th class="TITLE">List of xxxxx Sites</th></tr>
      </table>
      <p>
      <h:form id="someform">
      
       <div align="right">
       <h:commandLink action="preferences">
       <h:outputText value="Preferences"/>
       </h:commandLink>
       </div>
      
       <rich:dataTable
       onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       cellpadding="0" cellspacing="0"
       width="800" border="0"
       value="#{mySiteBean.sites}"
       var="site"
       id="siteListTable"
       rows="#{myUserPreferencesManagedBean.sitesPerPage}">
      
       <h:column>
       <f:facet name="header">
       <h:commandLink action="#{mySiteBean.sortById}" immediate="true">
       <h:outputText value="Site ID"/>
       </h:commandLink>
       </f:facet>
       <h:outputText value="#{site.id}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:commandLink action="#{mySiteBean.sortByStatus}" immediate="true">
       <h:outputText value="Site Status"/>
       </h:commandLink>
       </f:facet>
       <h:outputText value="#{site.status}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:commandLink action="#{mySiteBean.sortBySiteName}" immediate="true">
       <h:outputText value="Site Username"/>
       </h:commandLink>
       </f:facet>
       <h:outputText value="#{site.username}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="Site Password"/>
       </f:facet>
       <h:outputText value="#{site.password}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value=""/>
       </f:facet>
       <h:commandButton action="#{mySiteBean.editSpecificSite}" value="Edit" />
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value=""/>
       </f:facet>
       <h:commandButton action="#{mySiteBean.deleteSpecificSite}" value="Delete" />
       </h:column>
       </rich:dataTable>
      
      <rich:datascroller for="siteListTable">
       <f:facet name="next">
       <h:outputText value="Next"/>
       </f:facet>
       <f:facet name="previous">
       <h:outputText value="Previous"/>
       </f:facet>
      </rich:datascroller>
      
      <rich:spacer height="50"/>
       <rich:separator align="center" lineType="solid"/>
       <rich:spacer height="50"/>
      
       <table border=5>
      <tr><th class="TITLE">Add An xxxx Site</th></tr>
      </table>
      
       <rich:panel>
       <f:facet name="header">
       <f:verbatim>Enter Site Information</f:verbatim>
       </f:facet>
       <h:panelGrid columns="3">
       <h:outputText value="Site Name: " />
       <h:inputText value="#{mySiteBean.sitename}" /><h:outputText value="*" style="span"/>
       <h:outputText value="Pass Phrase:"/>
       <h:inputSecret value="#{mySiteBean.passphrase}" redisplay="false"/><h:outputText value="*" style="span"/>
       </h:panelGrid>
       <h:commandButton action="#{mySiteBean.addToSite}" value="Add Site" />
       </rich:panel>
      
      </h:form>
      </center></body></html>
      </f:view>
      


      I have messed around with where I put the form and sometimes, when I get some of the links or buttons to function, they take me to the first tab in this tabset which is not what I want. Other <h:form> configurations, it complete shreads my layout, moving layout objects around.

      Any thoughts or ideas would be appreciated.