You need to sign in to do that
Don't have an account?
jeremy_ross
Need action method called if user presses Enter to submit form
In a form with only one button, if a user hits enter to submit, the submit button's action does not get called. Other than javascript, is there a way to call a controller method when the user submits the form by pressing Enter?
Note that in my case, the form button is using reRender. Not sure if that has any effect on the above.
Jeremy
Note that in my case, the form button is using reRender. Not sure if that has any effect on the above.
Jeremy
http://salesforcesource.blogspot.com/2008/09/search-box-that-searches-when-user-hits.html
http://salesforcesource.blogspot.com/2008/09/search-box-that-searches-when-user-hits.html
Cheers
Thanks for the link.
Would you happen to know if salesforce has a fix planned for this so the javascript hack is not required?
Jeremy
If you have a single button in a form, that button should get fired when you press enter. There is, however, a bug in IE (not Visualforce) where the button is not fired on enter if there's only one input in the form. The workaround (in Visualforce and in HTML) is to add an empty input that's hidden by CSS to the form.
This workaround has been successful for us without the need for javascript, so I'm not sure why you had to resort to it.