title: Prevent tab-siwtch on p:tabView when form validation fails
body: <p>I'm using a tabView-Element of primefaces. The first tab points to the "Home" element the second one to a registration form. The registration form is validated. The problem is, when the form is validated the user is redirect to the home tab. When the user navigates back, he can see the validation errors. </p>
  
  <p>This seems to be a more or less common problem, but I did not find a proper solution. I tried out Oleg Varaksin <a href="http://ovaraksin.blogspot.de/2013/02/how-to-prevent-tab-changing-in.html?showComment=1369987144645#c2363045645571844425" rel="nofollow">suggestion</a> to prevent a user switching tabs when a form validation failed, but my problem starts earlier. </p>
  
  <p>I tried to fiddle aorund with the onTabChange event but with no success. Is there a mistake in my code or how can I approach may probelm? I would welcome a push in the right direction.</p>
  
  <pre><code>&lt;p:tabView id="mainTabView"&gt;
      &lt;p:tab title="Startseite" id="startPage"&gt;
          &lt;p:layout style="min-width:400px;min-height:400px;border:none !important"
              id="layout_login"&gt;
              &lt;p:layoutUnit position="west" size="305"&gt;
                  &lt;p:panel&gt;
                      &lt;h:form id="loginForm"&gt;
                          &lt;p:panelGrid columns="2" styleClass="gridWithNoBorders reducedFontSize"&gt;
                              &lt;p:outputLabel value="Benutzername:" /&gt;
                              &lt;p:inputText size="14" value="#{data.username}" /&gt;
                              &lt;p:outputLabel value="Passwort:" /&gt;
                              &lt;p:inputText size="14" value="#{data.loginPassword}" /&gt;
                          &lt;/p:panelGrid&gt;
                          &lt;p:separator /&gt;
                          &lt;h:commandButton styleClass="reducedFontSize" value="Anmelden" /&gt;
                      &lt;/h:form&gt;
                  &lt;/p:panel&gt;
              &lt;/p:layoutUnit&gt;
              &lt;p:layoutUnit position="center"&gt;
                  &lt;p:panel&gt;
                  Lorem ipsum dolor sit amet(...)
                  &lt;/p:panel&gt;
  
                          &lt;/p:layoutUnit&gt;
          &lt;/p:layout&gt;
      &lt;/p:tab&gt;
      &lt;p:tab id="registrationPage" title="#{ivy.cms.co('/Translations/Registration/tabTitleRegistration')}" &gt;
  
          &lt;h:form id="registrationForm"&gt;
              &lt;p:panel header="#{ivy.cms.co('/Translations/Registration/panelHeaderRegistration')}"&gt;
                  &lt;p:panelGrid columns="3"&gt;
  
                      &lt;p:outputLabel value="#{ivy.cms.co('/Translations/Registration/labelEmail')}" /&gt;
                      &lt;p:inputText value="#{data.email}" id="email1" required="true" requiredMessage="#{ivy.cms.co('/Translations/Registration/enterEmailAddress')}"&gt;
                          &lt;f:validator validatorId="EmailValidator" /&gt;
                          &lt;f:validator validatorId="EmailCompareValidator" /&gt;
                      &lt;/p:inputText&gt;
                      &lt;p:message for="email1" /&gt;
  
                      &lt;p:outputLabel value="#{ivy.cms.co('/Translations/Registration/labelRepeatEmail')}" /&gt;
                      &lt;p:inputText value="#{data.emailConfirm}" id="email2" required="true" requiredMessage="#{ivy.cms.co('/Translations/Registration/repeatMailAddress')}"&gt;
                          &lt;f:validator validatorId="EmailValidator" /&gt;
                      &lt;/p:inputText&gt;
                      &lt;p:message for="email2"/&gt;
  
                      &lt;p:outputLabel value="#{ivy.cms.co('/Translations/Registration/labelPrename')}" /&gt;
                      &lt;p:inputText value="#{data.prename}" id="prename" required="true" requiredMessage="#{ivy.cms.co('/Translations/Registration/enterPrename')}"/&gt;
                      &lt;p:message for="prename"/&gt;
  
                      &lt;p:outputLabel value="#{ivy.cms.co('/Translations/Registration/labelSurname')}" /&gt;
                      &lt;p:inputText value="#{data.surname}" id="surname" required="true" requiredMessage="#{ivy.cms.co('/Translations/Registration/enterSurname')}"/&gt;
                      &lt;p:message for="surname"/&gt;
  
                      &lt;p:outputLabel value="#{ivy.cms.co('/Translations/Registration/labelPassword')}" /&gt;
                      &lt;p:password id="pwd1" value="#{data.registrationPassword}" match="pwd2"
                          required="true" feedback="true" requiredMessage="#{ivy.cms.co('/Translations/Registration/enterPassword')}"
                          weakLabel="#{ivy.cms.co('/Translations/Registration/passwordWeak')}"
                          goodLabel="#{ivy.cms.co('/Translations/Registration/passwordMedium')}"
                          strongLabel="#{ivy.cms.co('/Translations/Registration/passwordStrong')}" /&gt;
                      &lt;p:message for="pwd1"/&gt;
  
                      &lt;p:outputLabel value="#{ivy.cms.co('/Translations/Registration/labelRepeatPassword')}" /&gt;
                      &lt;p:password id="pwd2" value="#{data.confirmPassword}" required="true" requiredMessage="#{ivy.cms.co('/Translations/Registration/repeatPassword')}"/&gt;
                      &lt;p:message for="pwd2"/&gt;
  
                      &lt;h:commandButton value="#{ivy.cms.co('/Translations/Registration/finishRegistration')}"  actionListener="#{logic.startRegistration}" &gt;
                          &lt;p:ajax event="click" listener="#{logic.startRegistration}"/&gt; 
                      &lt;/h:commandButton&gt;
  
                  &lt;/p:panelGrid&gt;
              &lt;/p:panel&gt;
          &lt;/h:form&gt;
  
      &lt;/p:tab&gt;
  &lt;/p:tabView&gt;
  </code></pre>