• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JSF: Hitting Enter on an inputText component

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same exact problem. Any fixes found yet?
 
Tell me how it all turns out. Here is a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic