-
Notifications
You must be signed in to change notification settings - Fork 778
Closed
Copy link
Description
Describe the bug
When using <p:selectOneRadio> with <p:ajax event="change">, the change event is unexpectedly triggered even when the user selects the already-selected radio button. This is inconsistent with standard HTML behavior, where the change event should only fire when the selection changes.
Reproducer
GitHub Reproducer:
https://github.com/tsyki/primefaces-test/tree/bug-radio-change
Minimal XHTML example:
<h:form id="frmTest">
<p:selectOneRadio id="line" value="#{testView.radioValue}" layout="lineDirection">
<f:selectItem itemLabel="Option1" itemValue="Option1"/>
<f:selectItem itemLabel="Option2" itemValue="Option2"/>
<f:selectItem itemLabel="Option3" itemValue="Option3"/>
<p:ajax listener="#{testView.onRadioChange}" update="@form"/>
</p:selectOneRadio>
</h:form>Expected behavior
The change event should only fire when the user selects a different radio option than the currently selected one.
PrimeFaces edition
Community
PrimeFaces version
15.0.7
Theme
saga (default in primefaces-test)
JSF implementation
Mojarra
JSF version
4.0.11
Java version
Java 17 (Eclipse Temurin, build 17.0.16+8)
Browser(s)
No response
Metadata
Metadata
Assignees
Labels
🐞 defectBug...Something isn't workingBug...Something isn't working