I have a p:commandButton that actually is the logout button. It is placed in the north p:layoutUnit and if I press the enter key in any form it always log me out. I dont want that button to respond the enter key. How to do that?
Asked
Active
Viewed 3,848 times
3
Kaz Miller
- 879
- 3
- 23
- 39
2 Answers
5
Nest the button within this form tag:
<h:form id="thisform" onkeypress="if( event.keyCode == 13){event.keyCode=0;}">
Josef E.
- 2,119
- 2
- 14
- 29
5
Put a hidden button with no action in the logout form and capture the enter key via p:defaultCommand.
<p:defaultCommand target="dummy"/>
<p:commandButton id="dummy" process="@none" global="false" style="display:none;"/>
user1983983
- 4,683
- 2
- 14
- 23