Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JSF: Hitting Enter on an inputText component

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed that if I have an inputText control and a commandButton, hitting enter on the textfield just does a postback, whereas, on a non JSF driven page, hitting enter just submits the default button on the page.

Does this mean that I must also supply a listener on the inputText control that calls the same method in my bean as the commandButton?
 
author
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Gregg Bolinger:
I noticed that if I have an inputText control and a commandButton, hitting enter on the textfield just does a postback, whereas, on a non JSF driven page, hitting enter just submits the default button on the page.

Does this mean that I must also supply a listener on the inputText control that calls the same method in my bean as the commandButton?



Gregg,

I'm not quite sure what you mean -- hitting enter on a JSF form usually defaults to the first button, like any other HTML form. Let's say you had a navigation rule like this:



And you have a page like this:



If you hit enter, it'll execute the "default" button, and try to load "anotherpage.jsp". If you click on the "not default" button, it'll simply redisplay the page.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I have something strange happening. I have a login page and after I type my username and password I hit and enter and everything works fine. I have another page with a single textfield and a button for looking up an employee by their ID number. I type in the ID and hit enter and the page just posts back to itself. If I click the Button, it works as expected, navigating to another page. There is nothing else on the page except a label.
[ September 02, 2004: Message edited by: Gregg Bolinger ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ammendment, it work fine in Firefox. IE is where I am having the problem.
 
Kito Mann
author
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Gregg Bolinger:
Ammendment, it work fine in Firefox. IE is where I am having the problem.



Hmmm.. What version of IE do you have? And can you show us the page you're having a problem with?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have IE 6.0. Here is the employeelookup.jsp:



And here is the EmployeeLookupBean.java


Here is the Navigation Rule:


The only difference between the way I constructed this page and the way I constructed the login page is that this page has a header which has some commandLinks in them. Could it be that one of the commandLinks is taking the default away from my Lookup commandButton? But then again, why would it work in Firefox and not IE if this was the case?


[ September 03, 2004: Message edited by: Gregg Bolinger ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the same exact problem. Any fixes found yet?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic