1 Reply Latest reply on Oct 17, 2011 1:47 PM by ibstmt

    Validate extendedDataTable selection

    atharumar Newbie

      JSF 1.2 Richfaces 3.3.3

      using Extended Data Table with okay button

      <a4j:commandButton value="OK" reRender="nextPanel" action="#{userBean.takeSelection}" onclick="#{rich:component('thisPanel')}.hide()" oncomplete="#{rich:component('nextPanel')}.show()" styleClass="formButtonClass" /> 

      Is there a way to not to show nextPanel untill a row is selected? In other words how to validate the selection is atleast 1 ?

        • 1. Re: Validate extendedDataTable selection
          ibstmt Newbie

          You can do a test in your onClick and onComplete expressions:

           

          <a4j:commandButton value="OK" reRender="nextPanel"

          action="#{userBean.takeSelection}"

          onclick="if (#{userBean.rowSelected}) #{rich:component('thisPanel')}.hide()"

          oncomplete="if (#{userBean.rowSelected}) #{rich:component('nextPanel')}.show()"

          styleClass="formButtonClass" />

           

          ... where you have a isRowSelected method in your bean that returns true if a row was selected. If a row wasn't selected, that same method can generate a message for the user.