You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DefaultCommand component only works when it targets CommandButtons that are linked to (using the form-attribute), but placed outside the form. See reproducer.
I'm not entirely sure if this should be classified as a bug or not, but I thought it would make sense if this usage would be supported (it sure would help in my use-case).
I already looked through the code and noticed that it indeed doesn't take into account buttons that are not placed inside the form, it only takes into account the form that is actualy enclosed by the target button:
If possible I'd like to contribute with a fix for this!
Reproducer
In the reproducer I created a form with an InputText, CommandButton "Submit inside form" and DefaultCommand. Next to the form there's another CommandButton "Submit outside form" that is linked to the form using the form-attribute. I configured the DefaultCommand to point to button "Submit outside form", but when I press the Enter-key when my focus is in the InputText, the form is submitted using button "Submit inside form".
When pressing the enter key in the InputText, the form should be submitted by button "Submit outside form", as configured in the DefaultCommand component.
PrimeFaces edition
Community
PrimeFaces version
13.0.8
Theme
No response
JSF implementation
All
JSF version
2.3
Java version
17
Browser(s)
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
The DefaultCommand component only works when it targets CommandButtons that are linked to (using the form-attribute), but placed outside the form. See reproducer.
I'm not entirely sure if this should be classified as a bug or not, but I thought it would make sense if this usage would be supported (it sure would help in my use-case).
I already looked through the code and noticed that it indeed doesn't take into account buttons that are not placed inside the form, it only takes into account the form that is actualy enclosed by the target button:
primefaces/primefaces/src/main/resources/META-INF/resources/primefaces/forms/forms.defaultcommand.js
Line 40 in 3c1945e
If possible I'd like to contribute with a fix for this!
Reproducer
In the reproducer I created a form with an InputText, CommandButton "Submit inside form" and DefaultCommand. Next to the form there's another CommandButton "Submit outside form" that is linked to the form using the form-attribute. I configured the DefaultCommand to point to button "Submit outside form", but when I press the Enter-key when my focus is in the InputText, the form is submitted using button "Submit inside form".
PrimeFaces_DefaultCommand_reproducer.zip
Relevant portion from reproducer:
Expected behavior
When pressing the enter key in the InputText, the form should be submitted by button "Submit outside form", as configured in the DefaultCommand component.
PrimeFaces edition
Community
PrimeFaces version
13.0.8
Theme
No response
JSF implementation
All
JSF version
2.3
Java version
17
Browser(s)
No response
The text was updated successfully, but these errors were encountered: