This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSF and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark ""Enter" key is not working properly" Watch ""Enter" key is not working properly" New topic
Author

"Enter" key is not working properly

RajatGupta Gupta
Greenhorn

Joined: Feb 03, 2012
Posts: 1
Hello All,

I have a jsf application in which I have used xhtml to display the presentation layer. Screen which I have designed has just 1 text field, and a command button. When user provides some input and presses "Enter" key, then page just refreshes but command button action is not invoked.

However, if my form contains 2 text fields, instead of 1 text field - then after user provides input and presses "enter" key - controls reaces to command button action and everything works fine.

I have tested this multiple forms, and every form is having same behaviour , i.e if form contains just single text field - Enter key does not work.

Rajat
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17149
    
  27

Welcome to the JavaRanch, Rajat!

Internet Exploder strikes again! On virtually every web browser except IE, if a form has only one submit button, hitting Enter will cause the form to be submitted. IE doesn't work right. so you have to add some extra javascript. You might want to google for details.


An IDE is no substitute for an Intelligent Developer.
J Miller
Ranch Hand

Joined: Oct 21, 2010
Posts: 78
What I have done for this before, as an easy work-around, is to include the second box, but hide it using CSS. It may not be the most elegant solution, but it works. It would look like this:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "Enter" key is not working properly
 
It's not a secret anymore!