0

First of all, I'm under JSF 1.2, RichFaces 3.3.0 and Tomahawk 1.1.9.

I have a rich:tabPanel which contains one form in each tab:

<h:form>
    // This manages error messages thrown by my application:
    <jsp:include page="showError.jsp" flush="true" />

    <rich:tabPanel switchType="client" selectedTab="#{MyBean.selectedTab}">
        <rich:tab name="tab1" label="TAB-1">
            <t:subform id="subForm1">
                //Some components such as h:inputText and h:selectOneMenu
                <t:commandButton actionFor="subform1" action="#{BeanForm1.insertData}" value="INSERT">
                    <f:setPropertyActionListener target="#{MyBean.selectedTab}" value="tab1" />
                </t:commandButton>
            </t:subform>
        </rich:tab>
        <rich:tab name="tab2" label="TAB-2">
            <t:subform id="subForm2">
                //Some components such as h:inputText and h:selectOneMenu
                <t:commandButton actionFor="subform2" action="#{BeanForm2.insertData}" value="INSERT">
                    <f:setPropertyActionListener target="#{MyBean.selectedTab}" value="tab2" />
                </t:commandButton>
            </t:subform>
        </rich:tab>
    </rich:tabPanel>

I want the application to keep the view in the tab where the user has submit the subform, even if it hasn't passed the validations I've defined. At this time, the 'MyBean.selectedTab` value only changes when the subform has been validated and submitted.

Is there any way to force this change even if the form fails the validations? Maybe I'm not focusing the problem in the proper way, how can I get this behaviour?

Thanks in advance.

jmrodrigg
  • 600
  • 6
  • 24
  • For JSF 2.0, there's a solution in flavor of [OmniFaces ``](https://showcase-omnifaces.rhcloud.com/showcase/taghandlers/ignoreValidationFailed.xhtml). You might want to check its source code and alter it for JSF 1.2. – BalusC Oct 24 '12 at 15:54
  • I've found a solution: I've added a `valueChangeListener` listener on the tabPanel that updates `MyBean.selectedTab` value according to the selected tab's name. I also had to add the tag `immediate=true`. Now the page behaves as I want although it doesn't scroll to the top... but it's something. – jmrodrigg Oct 25 '12 at 09:55

0 Answers0