Page 1 of 1

DefaultCommand does not work without form

Posted: 17 Jul 2017, 05:19
by trung.do
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?
Thanks

Re: DefaultCommand does not work without form

Posted: 17 Jul 2017, 10:11
by tandraschko
Yep, thats true.
Check line 20 here: https://github.com/primefaces/primeface ... command.js

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

Default:

Code: Select all

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

Your dialog:

Code: Select all

<p:defaultCommand container="myDialog" />
Feel free to create a feature request.

Re: DefaultCommand does not work without form

Posted: 18 Jul 2017, 05:04
by trung.do
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).