You need to sign in to do that
Don't have an account?
Naresh Krishna.ax1176
commandButton function on click of Enter key
Hi,
I have a input textbox and a command button in a page. When the user enters some text and clicks on the button i am invoking a method in Apex class.
The same functionality should be performed even when the user enters some text and clicks enter key.
I think this can be achieved using accessKey property of commandButton. I tried but it didn't worked.
Can someone please help me on this.
have a look at
http://cloud.sealvasoftware.com/2012/01/bindenterbutton_en/
(I'm starting a blog, that was my first Idea and needed more text, but as you need it, I have decided to publish it now)
If that solved your problem, please mark it as solved.
Regards
All Answers
Hi,
Have you tried with accessKey="Enter".. or Any other.
If this i right Answer then make it as a solution.
have a look at
http://cloud.sealvasoftware.com/2012/01/bindenterbutton_en/
(I'm starting a blog, that was my first Idea and needed more text, but as you need it, I have decided to publish it now)
If that solved your problem, please mark it as solved.
Regards
Hi Naresh,
You can use onchange,onblur event on Input Text and use apex:actionFunction and call the function which you are calling on the button click.
Thanks
Shailu
It worked. Thanks a lot :)
I have two button like new event and search in vf page.
when i press enter key in the page opening New vf page realted to new event button.
but here i need to stay search page only .
how can i do
<td align="center" colspan="6"><apex:commandButton id="cmdSearchEvent" value="{!$Label.cEMS_Search}"
action="{!FunSearch}"/></td>
<td align="right" width="50%"><apex:commandButton id="cmdAddNewEvent" value="{!$Label.cEMS_New_Event}"
action="{!FunNewEvent}" />
any one can help onthis?
Won't changing
by
And using the component I mentioned on the URL provided some posts above provide the functionality you are looking for?
(Right now, pressing Enter calls an unwanted button (I believe that is the first button that has no reRender on it), and you want to trigger another button's action. Is this right? if so, check the link I'm talking about (cloud.sealvasoftware....)
Regards
Thank you very much for gave answer.
now iam going to implement this.
i will update on this scenario what happend to me .
I'll wait for it ;)
Hi Selva,
yes , your code is working fine now.
thanks ,
keep posting solutions ..
sorry for the late reply.
i have two fields description and topic . these two fields are taking spaces by default. how can i restirct this situation in coding.
Thanks,
somesh.
Hi Selava,
Search Command button is not working in IE.
but its working in chrome and firefox good.
client asking need to check on IE also.
Could you please help on this.
Which IE version do you have?
Latest version only iam using.
I think it is fixed now.
just have to change the event that captures the key.
http://cloud.sealvasoftware.com/2012/01/bindenterbutton_en/