PrimeFaces.ajax.Request.handle does not cause validation of TabView anymore #123
-
Hi! We are currently migrating from PrimeFaces 7 to PrimeFaces 13 and previously used the following JavaScript to manually trigger validation when switching the tabs of a TabView component. Sadly, it's not working anymore, and I don't know why. I would appreciate the help of anyone with the relevant PrimeFaces JS knowledge 😀 Reproducer: https://github.com/mkomko/primefaces-test/tree/tabview-ajax-handle-validationfailed Validation should be triggered when switching tabs and an alert should be displayed, but it never happens. JavaScript: $(function () {
$.extend(PF("widget"), {
onTabChange: function (tabIndex) {
let $this = this;
PrimeFaces.ajax.Request.handle({
source: $this.id,
process: $this.panelContainer.children().eq($this.cfg.selected).attr("id"),
update: $this.id,
oncomplete: function (xhr, status, args) {
if (args.validationFailed) {
alert("Validation failed!")
}
}
});
}
});
}); XHTML: <p:tabView widgetVar="widget"
onTabChange="return PF('widget').onTabChange(index)">
<p:ajax event="tabChange"/>
<p:tab title="1">
<p:outputLabel value="1" for="text1"/>
<p:inputText id="text1" value="#{testView.text1}" required="true"/>
<p:message for="text1">
<p:autoUpdate/>
</p:message>
</p:tab>
<p:tab title="2">
<p:outputLabel value="2" for="text2"/>
<p:inputText id="text2" value="#{testView.text2}" required="true"/>
<p:message for="text2">
<p:autoUpdate/>
</p:message>
</p:tab>
<p:tab title="3">
<p:outputLabel value="3" for="text3"/>
<p:inputText id="text3" value="#{testView.text3}" required="true"/>
<p:message for="text3">
<p:autoUpdate/>
</p:message>
</p:tab>
</p:tabView> Thank you very much in advance! What we are trying to achieve in the end and had working using PrimeFaces 7:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
I pulled your reproducer down and it's working? Am I missing something? |
Beta Was this translation helpful? Give feedback.
-
@FlipWarthog Thank you very much for your answer. After testing again I found out that it works using Mojarra, but not using MyFaces! Pinging MyFaces experts @tandraschko @melloware 😁 |
Beta Was this translation helpful? Give feedback.
-
@melloware are you sure validationFailed is called on server side? |
Beta Was this translation helpful? Give feedback.
-
pf-tabview.zip |
Beta Was this translation helpful? Give feedback.
@mkomko can you open a MyFaces bug. I just compared the two response XML and MyFaces is stripping out some data.
I shortened it for clarity
Mojarra:
MyFaces:
<parti…