hi all... i'm trying to submit a form when a user hits enter. i'm new to myfaces, so i'm probably missing something simple. seems like this is done with javascript. below is my javascript which I found from this site. my problem is, how/where do i invoke the javascript ? currently, there's a commandLink that's submitting the form. I have a few inputText fields and a few dropdowns on the form.
here's the commandLink: <af:commandLink text="#{messages['search']}" action="#{searchStandardsController.allDataStandardsSearch}" styleClass="lightbutton"/> here's my javascript: function submitEnter(commandId,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { clickLink(commandId); return false; } else return true; } function clickLink(linkId) { var fireOnThis = document.getElementById(linkId) if (document.createEvent) { var evObj = document.createEvent('MouseEvents') evObj.initEvent( 'click', true, false ) fireOnThis.dispatchEvent(evObj) } else if (document.createEventObject) { fireOnThis.fireEvent('onclick') } } </script> -- View this message in context: http://www.nabble.com/enter-key-form-submission-%28newbie-question%29-tp15641660p15641660.html Sent from the MyFaces - Users mailing list archive at Nabble.com.