+ Start a Discussion
SaintMichaelSaintMichael 

Unable to invoke action 'AutoComplete.getDesignations': no controller and/or function found

Do I need to activate Remote JavaScripting?

 

Here is my controller and visualforce:

 

Controller:

global with sharing class AutoComplete {

public static List<String> designations{get;set;}




public AutoComplete(){
	
}


@RemoteAction
global static List<String> getDesignations(){
	List<Designation_Abbreviation__c> abbs = [Select Name, Designation__r.Name from Designation_Abbreviation__c];
	designations = new List<String>();
	
	Integer x = 0;
	for(Designation_Abbreviation__c d: abbs){
		designations.add(d.Name +' '+d.Designation__r.Name);
		
		
	}
	
	return designations;
}


}

 

VisualForce:

<apex:page controller="AutoComplete">
<apex:includeScript value="{!URLFOR($Resource.AutoCompleteJQuery, 'AutoCompleteJQuery/jquery-1.8.1.min.js')}" />

  <apex:includeScript value="{!URLFOR($Resource.AutoCompleteJQuery, 'AutoCompleteJQuery/jquery-ui-1.8.23.custom.min.js')}" />
  <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/themes/smoothness/jquery-ui.css" />

<script type="text/javascript">

	$(function() {
	var availableTags;
	        Visualforce.remoting.Manager.invokeAction(
            '{!$RemoteAction.AutoComplete.getDesignations}',
            function(result, event){
                if (event.status) {
                 	
                 	availableTags = result.designations;
                }else if(event.type == 'exception'){
                	alert (event.message);
                }
            }, 
            {escape: true}
        );
		
		
		
		$( "#tags" ).autocomplete({
			source: availableTags
		});
	});
	
	
	
	
	
	
</script>




<div class="demo">

<div class="ui-widget">
	<label for="tags">Tags: </label>
	<input id="tags"/>
</div>

</div> 





</apex:page>

 

 

Starz26Starz26

Conflict with the class name AutoComplete

 

change the class name to something else like AutoCompleteMe and it will work