2 Replies Latest reply on Oct 2, 2009 8:13 AM by josafassj

    Submit a form created with checkboxes generated by c:forEach

    josafassj

      Hi everybody,

      I'm trying to build a form with check boxes dynamicly built with labels from a database table.
      I had built the form but when I try to submit it, the action method is not called.
      I'm building the form whit a c:forEach, when I remove the forEach the form is submitted.

      here is the code:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:t="http://myfaces.apache.org/tomahawk"
       xmlns:c="http://java.sun.com/jstl/core">
      
       <a4j:form>
       <rich:toolBar height="26" itemSeparator="grid">
       <rich:toolBarGroup>
       <a4j:commandLink action="#{menu.verPontos}">
       <h:graphicImage value="/images/icons/undo.gif" styleClass="pic"/>
       </a4j:commandLink>
       </rich:toolBarGroup>
       </rich:toolBar>
       <br />
       <rich:panel header="Cadastrar caracterÃÂsticas ambientais do ponto #{pontoFaces.ponto.nome}">
       <t:panelGrid columns="2">
       <h:outputLabel value="Campanha" />
       <t:selectOneMenu value="#{pontoFaces.campanha}" id="campanhas" >
       <f:selectItem itemLabel="Selecione..." itemValue="0" />
       <t:selectItems value="#{campanhaFaces.lc}" var="sb" itemLabel="#{sb.campanha}" itemValue="#{sb.campanhaId}" />
       </t:selectOneMenu>
       </t:panelGrid>
       <t:panelGrid columns="4">
       <c:forEach items="#{grupoAmbientalFaces.list_grupos}" var="grupos">
       <rich:panel header="#{grupos.grupo}">
       <t:selectManyCheckbox id="#{grupos.grupoAmbientalId}" layout="pageDirection">
       <t:selectItems value="#{grupos.caracteristicaAmbientalCollection}" var="ca"
       itemLabel="#{ca.caracteristica}" itemValue="#{ca.caracteristicaAmbientalId}"/>
       </t:selectManyCheckbox>
       </rich:panel>
       </c:forEach>
       </t:panelGrid>
       <t:panelGrid columns="1">
       <a4j:commandButton style="float:left" action="#{pontoFaces.addCaracteristicasAmbientais}" value="Confirmar" />
       </t:panelGrid>
       </rich:panel>
       </a4j:form>
      </ui:composition>