hello, are you using trinidad? (trinidad provides the possibility of default command components - see [1] - have a look at defaultCommand)
--- if you would like to use your custom javascript implementation, you have to attach the keypress event. e.g.: function init() { if (document.addEventListener) { window.addEventListener("keypress", ..., ...); } else { document.attachEvent("onkeypress", ...); } } within your page: <body onload="init();"> you have to adjust your existing javascript implementation to use this mechanism! regards, gerhard [1] http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_form.html 2008/2/22, jnl1 <[EMAIL PROTECTED]>: > > > 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. > > -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces