DefaultCommand does not work without form

Components, Ajax Framework, Utilities and More.
Post Reply
Posts: 2
Joined: 17 Jul 2017, 05:06

17 Jul 2017, 05:19

hi Primefaces
I'm using pf 5.3, i'm using default command component to handle user bahaviour when user hit enter key button. My requirement is user must hit to a positive button (like Next/Yes/OK/...) in that case. it work fine with normal form but not for dialog with no form or input.
That's dialog that just show one message with two button yes/no. user hit yes we just hide that dialog so which mean no need server-side dialog here.
Any suggestion for this case?

PrimeFaces Core Developer
Posts: 3174
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE

17 Jul 2017, 10:11

Yep, thats true.
Check line 20 here: ... command.js

We can probably make it configurable to allow configuration of the container. e.g.:


Code: Select all

<p:defaultCommand container="@form" />

Your dialog:

Code: Select all

<p:defaultCommand container="myDialog" />
Feel free to create a feature request.
Always Bet On Prime (+ Extensions)!

Thomas Andraschko
PrimeFaces Developer | PrimeFaces Extensions Founder
Apache OpenWebBeans PMC | Apache DeltaSpike PMC | Apache MyFaces PMC

Personal Blog:
Posts: 2
Joined: 17 Jul 2017, 05:06

18 Jul 2017, 05:04

Thanks @tandraschko
For moment i will overwrite that feature on Primefaces
Another thing, why we have to focus on input in order to use Enter key (by DefaultCommand), if i just open the page and press enter, notthing happen. I've tested on Chrome (latest).

Post Reply
  • Information