user1669692
user1669692

Reputation: 119

Tab is displaying the default , Need to show the tab which we select

I am using prime face version 3.4 , The problem is with the tab view display.

<p:messages id="messages"/>
<p:tabView id="tabView" dynamic="false">

    <p:tab id="tab1" title="Navigation">

    <p:tab id="tab2" title="Email Address">

    <p:tab id="tab3" title="Password">

</p:tabView>

It's a Tabbed page with 3 Tabs(Notification , Email and Password) , If am on Email tab without entering any values i click submit , it displays the error message at the top and default to the first tab , I need to show the Email Tab

Upvotes: 0

Views: 1300

Answers (2)

Andre
Andre

Reputation: 3904

With ajax=false, the whole page gets refreshed after you click the button and tab view takes you to the first page just as if you were navigating to that page for the first time.

You could either set Ajax to true or use an integer on your bean as the selected index for the tabview (there's a property called selectedIndex on the tabview if memory doesn't fail me). The second option, however, would only work for view, session and application scoped beans.

Upvotes: 1

kauedg
kauedg

Reputation: 817

Place the <p:messages id="messages"> tag inside the <p:tab id="tab2" title="Email Address"> tag. Note that it will display messages from any validated component inside the same form (or from any of your tabs). You should use <p:message for="componentId"> to show component-specific messages.

Upvotes: 0

Related Questions