Reputation: 979
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?
Upvotes: 5
Views: 4423
Reputation: 2219
Nest the button within this form tag:
<h:form id="thisform" onkeypress="if( event.keyCode == 13){event.keyCode=0;}">
Upvotes: 5
Reputation: 4841
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;"/>
Upvotes: 7