-
1. Re: how to execute default action when enter key pressed
ramki9977 Jan 15, 2009 6:02 AM (in response to ramki9977)hi,
i tried something like this
<h:inputText
id="userIdText"
value="#{loginBean.supportLoginId}"
onkeypress="javascript:
if(event.keyCode==13){
document.getElementById('itSupportLoginView:itSupportLoginForm:signon').click();}"/>
<h:commandButton id="signon" styleClass="button_style"
value="#{messages.labelGFSemployeeLogin_SignOn}"
action="#{loginBean.signOnSupportUser}"/>
but here the problem is action being executing correctly, but its not going to next screen. retains in same screen. please help me. -
3. Re: how to execute default action when enter key pressed
ramki9977 Jan 15, 2009 7:00 AM (in response to ramki9977)hi,
thanks for reply. i saw that post. but i have one doubt here.
<h:form id="form">
<h:commandButton action="#{bean.action}" value="Link" id="link" styleClass="defaultLink"/>
<rich:hotKey selector="#form" key="return" type="keypress" handler="event.preventDefault(); jQuery('.defaultLink').click()" disableInInput="false" disableInInputTypes=""/>
<h:inputText value="" />
</h:form>
in the above code where are we specifying on which button click event should happen?
jQuery('.defaultLink').click() ???
i am not able to understand this. can you please explain to me? -
4. Re: how to execute default action when enter key pressed
cremersstijn Jan 15, 2009 7:19 AM (in response to ramki9977)It looks for the component with the style class "defaultLink". In the example it is the commandbutton.
<h:commandButton action="#{bean.action}" value="Link" id="link" styleClass="defaultLink"/> -
5. Re: how to execute default action when enter key pressed
ramki9977 Jan 15, 2009 7:23 AM (in response to ramki9977)hi,
thanks for quick reply. but in my app suppose i have four buttons witch same styleClass. then which one will it take? is there any way to say button id? -
6. Re: how to execute default action when enter key pressed
cremersstijn Jan 15, 2009 8:10 AM (in response to ramki9977)try this:
<rich:hotKey selector="#form" key="return" type="keypress" handler="event.preventDefault(); jQuery('#form:link').click()" disableInInput="false" disableInInputTypes=""/> -
7. Re: how to execute default action when enter key pressed
ramki9977 Jan 23, 2009 1:19 AM (in response to ramki9977)hi,
i tried with above code.its not working. its showing some java script error. any idea. -
8. Re: how to execute default action when enter key pressed
nbelaevski Jan 23, 2009 7:22 AM (in response to ramki9977)"ramki9977" wrote:
":" char should be escaped. See: http://jboss.com/index.html?module=bb&op=viewtopic&t=149005 for more information.
hi,
i tried with above code.its not working. its showing some java script error. any idea.
Another post on the topic: http://jboss.com/index.html?module=bb&op=viewtopic&t=148837 -
9. Re: how to execute default action when enter key pressed
ramki9977 Jan 27, 2009 4:11 AM (in response to ramki9977)hi,
thank you very much. now my problem is solved.