Reply
Regular Contributor
Swapnil
Posts: 23
Accepted Solution

Pressing enter on form with commandButton not working in IE

Hi,

 

    Pressing enter key on form with commandButton not working in IE, but it works fine in firefox. Its a search box and when I type something I want to hit enter to initiate the search. Any pointers...that I can try...

Regular Contributor
Swapnil
Posts: 23

Re: Pressing enter on form with commandButton not working in IE

Now I tried using inputText and onKeyEvent, even this worked in firefox but not in IE

Regular Contributor
Sarge
Posts: 138

Re: Pressing enter on form with commandButton not working in IE

Hi Swapnil,

 

   Try the following code in input text (Assuming you have "Go" button for search)

 

 

<apex:inputText value="{!searchKey}" onkeyup="initiateSearch()"/>
<apex:commandButton id="gobtn" value="Go" action="{!performSearch}"/>

<script type="text/javascript">
    function initiateSearch(){
var goBtn = document.getElementById('{!$Component.gobtn}');
if(window.event.keyCode == 13){
goBtn.click();
}
}
</script>

 

 

 

window.event.keyCode == 13
Cheers..
Regular Contributor
Swapnil
Posts: 23

Re: Pressing enter on form with commandButton not working in IE

Hey Thanks, this worked..

Trusted Contributor
nagalakshmi
Posts: 251

Re: Pressing enter on form with commandButton not working in IE

Hi Sarge,

 

I am also facing the same issue. I have a custom object. i am override the 'view' link with visual force page. In my visual force page i have a  command link. when i click on the command link it shows the list of child records. It is worked properly in google chrome and mozilla firefox. But in IE it is not working. when i click on the command link its just refresh the screen and displays the same screen.it does not open the child records panel. Please help me out how to solve this.

 

Thanks,

Lakshmi