Reputation: 713
I'm using jQuery tabs and I'm using a form with each tab. I have a submit button on the last form. If validation for all the forms is successful, I want to be able to submit all the forms.
<s:div id="wrapper">
<s:div id="maincontent">
<s:div id="tabs">
<ul>
<li><a href="#tabs-1" id="tab-1">Tab 1</a></li>
<li><a href="#tabs-2" id="tab-2">Tab 2</a></li>
<li><a href="#tabs-3" id="tab-3">Tab 3</a></li>
<li><a href="#tabs-4" id="tab-4">Tab 4</a></li>
</ul>
<s:div id="tabs-1">
<jsp:include page="/pages/tab1.jsp" />
</s:div>
<s:div id="tabs-2">
<jsp:include page="/pages/tab2.jsp" />
</s:div>
<s:div id="tabs-3">
<jsp:include page="/pages/tab3.jsp" />
</s:div>
<s:div id="tabs-4">
<jsp:include page="/pages/tab4.jsp" />
</s:div>
</s:div>
</s:div>
</s:div>
I have the tabs and validation working fine. Is there a way to submit all the forms when I press the submit button on the tab4 page?
Upvotes: 0
Views: 739
Reputation: 86
You can attach javascript listener to the button for the 'click' event.
$('.button4').on('click', function() {
$('.button').click();
});
This way you simulate click for the other buttons. I am supposing that the other three buttons have HTML class button and the last button has class button4. This is only for example.
Hope this helps.
Upvotes: 1