0 Replies Latest reply on Nov 11, 2009 9:50 AM by luciamg

    a4j:commandLink rerender and <rich:ajaxValidator event=

      Hello:
      I'm having a problem with the rerender property of a aj4:commandLink and a inputText with a validation. I have a form where is the input (with the ajaxValidation on the onblur event, and that input have the focus when i first enter on the page), when i submit de form i add the information to a table (all ok). In that table i have a a4j:commandLink to edit that information. When i press the command link i want to put the information on the form to edit, so i don't want to validate the form when i do that... so i put the table on a <a4j:region></a4j:region>. The problem is that when i press the form to edit, all the information is on the form, except the first input (with the focus and the validation). Other inputs with validation are ok, but the first never get the information. ¿Someone can help me?

      On the code, the input that never get the information is the one with the id 'nombreOpcion', and the commandLink i'm using is 'editarUnaOpcion'.

      <table>
       <tr class="obligatorio">
       <td><h:outputLabel for="nombreOpcion" value="#{mensajes['campo.nombre']}" /></td>
       <td>
       <h:inputText id="nombreOpcion" value="#{opcionPreferencia.nombreOpcion}" styleClass="grande" maxlength="100" >
       <rich:ajaxValidator event="onblur"/>
       </h:inputText>
       <h:message for="nombreOpcion" styleClass="errorMsn" />
       </td>
       </tr>
       <tr>
       <td><h:outputLabel for="descripcionOpcion" value="#{mensajes['campo.descripcion']}" /></td>
       <td><h:inputTextarea id="descripcionOpcion" value="#{opcionPreferencia.descripcionOpcion}" styleClass="grande" /></td>
       </tr>
       <tr class="obligatorio">
       <td><h:outputLabel for="valorOpcion" value="#{mensajes['campo.valor']}" /></td>
       <td>
       <h:inputText id="valorOpcion" value="#{opcionPreferencia.valorOpcion}" styleClass="corto">
       <s:convertNumber maxFractionDigits="0" maxIntegerDigits="8" type="number"/>
       <rich:ajaxValidator event="onblur"/>
       </h:inputText>
       <rich:message for="valorOpcion" styleClass="errorMsn" />
       </td>
       </tr>
       <cs:formValidez modelo="#{opcionPreferencia}" />
      </table>
      
      <div class="botonera">
       <h:commandButton action="anadirUnaOpcion" value="#{mensajes['boton.guardar']}" id="anadirUnaOpcion" styleClass="boton principal" />
       <h:commandButton action="cancelarOpcion" immediate="true" value="#{mensajes['boton.cancelar']}" id="cancelarOpcion" styleClass="boton" />
      </div>
      
      <a4j:region id="tablaOpciones">
       <h:dataTable id="tblOpcionesPreferencia" styleClass="listado" value="#{listaOpcionesPreferencia}" var="opc" rendered="#{listaOpcionesPreferencia.rowCount > 0}" rowClasses="par,impar">
       <h:column>
       <f:facet name="header">#{mensajes['cabecera.nombre']}</f:facet>
       #{opc.nombreOpcion}
       </h:column>
       <h:column>
       <f:facet name="header">#{mensajes['cabecera.descripcion']}</f:facet>
       #{opc.descripcionOpcion}
       </h:column>
       <h:column>
       <f:facet name="header">#{mensajes['cabecera.valor']}</f:facet>
       <h:outputText value="#{opc.valorOpcion}">
       <s:convertNumber maxFractionDigits="0" maxIntegerDigits="8" type="number"/>
       </h:outputText>
       </h:column>
      
       <h:column >
       <f:facet name="header">#{mensajes['cabecera.acciones']}</f:facet>
       <a4j:commandLink action="editarUnaOpcion" id="editarUnaOpcion" value="#{mensajes['boton.editar']}" styleClass="editar" title="Editar Opción de Preferencia" reRender="nombreOpcion,valorOpcion,descripcionOpcion" />
       <a4j:commandLink action="quitarUnaOpcion" id="quitarUnaOpcion" value="#{mensajes['boton.quitar']}" rendered="#{(opc.finValidez == null)}" styleClass="eliminar" title="Eliminar Opción de Preferencia" reRender="nombreOpcion,valorOpcion" />
       </h:column>
      
       <f:facet name="footer">
       <gmr:paginado varPaginado="#{paginadoOpciones}" accion="cambiarPaginaOpciones" />
       </f:facet>
       </h:dataTable>
      </a4j:region>