Daniel Bleisteiner
Daniel Bleisteiner

Reputation: 3310

How to use multiple forms inside <rich:tabPanel> with switchType="server"?

We switched from RichFaces 3 to 4 and have some conceptual problems with <rich:tabPanel>... with RichFaces 3 you could do something like that:

<rich:tabPanel switchType="server">
    <rich:tab header="A">
        <h:form>
            <h:commandButton value="A1" />
        </h:form>
        <h:form>
            <h:commandButton value="A2" />
        </h:form>
    </rich:tab>
    <rich:tab header="B">
        <h:form>
            <h:commandButton value="B" />
        </h:form>
    </rich:tab>
    <rich:tab header="C">
        <h:form>
            <h:commandButton value="C" />
        </h:form>
    </rich:tab>
</rich:tabPanel>

That no longer works with JSF 2 and RichFaces 4 – for <rich:tabPanel> needs its own <h:form> for switchType="server" or "ajax"... only client works without a form. So we now would have to build it like that:

<h:form>
    <rich:tabPanel switchType="server">
        <rich:tab header="A">
            <h:commandButton value="A1" />
            <h:commandButton value="A2" />
        </rich:tab>
        <rich:tab header="B">
            <h:commandButton value="B" />
        </rich:tab>
        <rich:tab header="C">
            <h:commandButton value="C" />
        </rich:tab>
    </rich:tabPanel>
</form>

That works... but I'm no longer able to separate between A1 and A2 which have been separate forms before.

How can we solve that problem without using switchType="client"?

Upvotes: 1

Views: 962

Answers (2)

Makhiel
Makhiel

Reputation: 3884

You can can limit the scope of the <a4j:commandButton execute="@region"> with @execute. Probably the easiest approach would be to wrap the data in an <a4j:region> and set execute="@region" on the button.

Upvotes: 1

Andrey
Andrey

Reputation: 6766

The multi forms support in rich:tabPanel ticket has been just recently rejected with recommendation to use a4j:region:

This will not be implemented, <a4j:region> can be used to limit the scope of execution inside a tab.

https://issues.jboss.org/browse/RF-11306

Upvotes: 1

Related Questions