function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
krish4ukrish4u 

Auto Complete Functionality with action function

Hi Folks ,

 

I am using Auto complete functionality for lookup. It is working fine, but after selecting the searched dropdown list record value which event will fire? I used onchange function not working[if i use onpress or onclick it will not work because of i am disabling enter function through script(see below)]. Already i tried different events like onselect etc. with out using  Auto complete  Onchange function working fine . Using onchnage mehod i am getting some values from controller based on account lookup value.

 

<script>    function noenter(ev)   

{       

if (window.event && window.event.keyCode == 13 || ev.which == 13)       

{           

var ele=document.getElementById(cl);           

ele.click();           

return false;       

}       

else       

{           

return true;       

}   

}

</script>

 <apex:inputField value="{!m.Account__c}" onkeypress="return noenter(event);" onchange="test()" id="acc">                  

<c:autoCompleteController objectname="Account" additionalfield="TickerSymbol" autocomplete_textbox="{!$Component.acc}" />        

 <apex:actionFunction name="test" action="{!sample}" reRender="pb1">         

<apex:param value="{!m.Account__c}" name="ac"/>       

 </apex:actionFunction>   

 </apex:inputfield>

 

plase suggest on this..........................................................................

 

thanks 

Krish

RagzRagz

Try this 

 

function noenter(e){
 
		     var key;    
		     if(window.event){
		          key = window.event.keyCode; //IE
		          //alert ('key entered - '+ key);
		     } 
		     else
		          key = e.which; //firefox    
		
		     return (key != 13);	

 		}

 

krish4ukrish4u

Hi,

 

thanks for reply,

 

but i tried with your code its not working fine. and another one is the auto complete not working for product object. do u have any idea. please find below code.

 

<apex:inputField value="{!a.Product__c}"  onkeypress="return noenter(event);"  id="prod"><c:autoCompleteController objectname="Product2" additionalfield="TickerSymbol" autocomplete_textbox="{!$Component.prod}" /></apex:inputField>

 

 

thank you very much.

 

krish

 

RagzRagz

Let me give you the link on how i implemented Autocomplete controller in my org. 

 

http://boards.developerforce.com/t5/Visualforce-Development/Visual-Force-Auto-Complete-Component/td-p/86116

 

this post helped me to comeup with autocomplete controller for City field on a visualforce page.

 

Hope the above link will help you too.