I'm not sure what I'm doing wrong, but I can't get the Tabs component to work properly when there's a form in one of the tabs.
I've reduced the problem down to a simple example, code like this:
public class About {
@Inject Logger logger;
@Persist @Property private int activeTab;
@Property private String field1;
}
<t:jquery.tabs t:tabs="tab1,tab2" t:activePanelId="activeTab">
<p:tab1>Tab 1 content</p:tab1>
<p:tab2>
<t:form t:id="form2">
<t:errors/>
<t:textfield t:id="tab2Field1" value="field1"/>
<input t:type="submit"></input>
</t:form>
</p:tab2>
</t:jquery.tabs>
</html>
The page displays correctly initially. If I just click on the tab headers, the content changes appropriately.
If I click "Tab2", then "submit", the selected tab in the heading goes back to Tab1, but the content shows Tab2's contents. Hit "submit" again, and the content follows the tab heading, i.e. we're back to tab1 completely.
If I instrument the setter for activeTab and enable event logging, you see this sequence of events for the Submit button:
[DEBUG] pages.About Dispatch event: ComponentEvent[activate from (self)]
[DEBUG] pages.About Dispatch event: ComponentEvent[prepareForSubmit from form2]
[DEBUG] pages.About Dispatch event: ComponentEvent[prepare from form2]
[DEBUG] pages.About Dispatch event: ComponentEvent[validate from tab2Field1]
[DEBUG] pages.About Dispatch event: ComponentEvent[selected from submit]
[DEBUG] pages.About Dispatch event: ComponentEvent[validate from form2]
[DEBUG] pages.About Dispatch event: ComponentEvent[success from form2]
[DEBUG] pages.About Dispatch event: ComponentEvent[submit from form2]
[DEBUG] pages.About Dispatch event: ComponentEvent[action from form2]
[DEBUG] pages.About Dispatch event: ComponentEvent[activate from (self)]
[DEBUG] pages.About Dispatch event: ComponentEvent[preallocateFormControlNames from (self)]
[DEBUG] pages.About Dispatch event: ComponentEvent[prepareForRender from form2]
[DEBUG] pages.About Dispatch event: ComponentEvent[prepare from form2]
[DEBUG] pages.About Dispatch event: ComponentEvent[toClient from tab2Field1]
[DEBUG] pages.About Dispatch event: ComponentEvent[activate from (self)]
[INFO] pages.About activeTab: 1 -> 0
[DEBUG] pages.About Dispatch event: ComponentEvent[SelectTab from tabs]
What am I doing wrong ?
Version information:
tapestry-core 5.3.7
tapestry5-jquery 3.4.0 and 3.4.1-SNAPSHOT
Regards,
Robin