1 Reply Latest reply on Aug 23, 2013 2:21 PM by Brian Leathem

    Prevent submit when switching tabs

    Douglas Ruskowski Haase Newbie

      I need to implement a simple form with two tabs. They should work independently but when I switch between them, the values are posted and updates the Managed Bean.

       

      I've seen this topic:  https://community.jboss.org/thread/174033

      But couldn't find a solution.

       

      When I tried switchType="client", the fist button lost it's specific text value and the first time I clicked on it, nothing happened.

      Besides, both input values were updated, I want to submit/update them only with the specific command buttons from each tab.

       

      I'm using Richfaces 4.3.1.

       

      <h:form>
           <rich:panel id="panel-header" style="width: 85%">
      
                 <a4j:region>
      
                      <rich:tabPanel id="abas" switchType="client">
      
                           <rich:tab id="aba1" header="Aba1" switchType="client">
                               <h:outputLabel value="Input:" />
                               <h:inputText value="#{beanTeste.texto1}" />
                               <h:commandButton value="Ação 2" action="#{beanTeste.acao1}" />
                           </rich:tab>
      
                           <rich:tab id="aba2" header="Aba2" switchType="client">
                                <h:outputLabel value="Input:" />
                                <h:inputText value="#{beanTeste.texto2}" />
                                <h:commandButton value="Ação 2" action="#{beanTeste.acao2}" />
                           </rich:tab>
      
                     </rich:tabPanel>
                </a4j:region>
           </rich:panel>
      </h:form>