I have some weird problem in my app.
I need to do the following and I achieved by using ajax events
1.add a tab dynamically ( using tab change event.when we click on + tab ,it will create new tab )
<p:ajax event="tabChange" listener="#{userBookBean.onBookTabChange}" update ="booksTabview"/>
2.remove a tab (using tab close event)
<p:ajax event="tabClose" listener="#{userBookBean.onBookTabClose}" update="booksTabview" />
3.Each tab have 5 input fields( Title, Author, Publisher, Rating (good, very good, excellent, must read), and Review ) all the input fields have its own ajax blur event call to submit its value.other wise all values are clear when switch the tab.
4.tab title can update by using one of the input field ( blur event )
<p:tab id="bookTab" title="#{book.title}">
<p:inputText value=#{book.title}">
<p:ajax event="blur" update="bookTab">
</p:inputText>
all above are working fine.
Except when I submit the form using commandButton, After edit those fields.Need to click twice the button first click send the ajax request with edited field value second one submit the whole form.
<p:commandButton value="Submit" actionListener="#{bookBean.submit}" update=":booksform :breadcrumpform :successgrowl :errorgrowl :exceptionDialog" />
Is there any way to solve this problem? or what was wrong in my code?