Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF Disable Enter key on <h:inputText......>

804987Sep 14 2010 — edited Sep 18 2010
Hello All,

Hope all of you are doing good. Currently we are using JSF 1.1 for our new application, i have got a requirement as follows. This is a weird problem i hope....
I have a <h:inputText....> component in my page and when if user presses "Enter" key the page is getting submitted. I have tried by adding the following lines of Javascript code but still it is not working. Could you please review and suggest me on this.

function kH(e) {
var pK = e ? e.which : window.event.keyCode;
return pK != 13;
}
document.onkeypress = kH;
if (document.layers) document.captureEvents(Event.KEYPRESS);


Any suggestions are really appreciated. Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 16 2010
Added on Sep 14 2010
5 comments
2,656 views