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
PrattyPratty 

Autocomplete is not working in visualforce page

 

Hello,

 

I have used autocomplete plugin for  country field in my VF page. It's not working.

 

Here's code,

 

//  controller

public class test extends abc

{

@RemoteAction
public static User[] getCityValue()
{
return [Select Id,City From User];
}

}

 

//  VF Page

 

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>

<script>
var availableTags = new Array();


$(document).ready(function() {
NPORegistration.getCityValue(getCityNames);
});

 

function getCityNames(result,event)
{
for( var iIndex = 0; iIndex < result.length; iIndex++)
{
var strCity =result[iIndex].City;
if( strCity != null && strCity.length > 0)
availableTags[iIndex] = strCity;   //   data is getting
}
var elemClientName = $('input[id$=txtCityId]');  //  Id is getting

$(elemClientName).autocomplete({source: availableTags , delay: 10});
}
</script>

 

<td>
<apex:inputText value="{!Reg.BillingCity}" id="txtCityId" />
</td>

 

Could anybody help me to get through this.

 

Regards,

 

Pratty

Suresh RaghuramSuresh Raghuram

After going thorugh your code i found

 

var in for (Var iIndex =0 ...........................)

 

usually we use integer which are a primitive datatype in apex .

 

i doubt on var please check with your var.

Suresh RaghuramSuresh Raghuram

sorry i didnt observe it is part of script code

cwall_sfdccwall_sfdc

Can you provide more details?  What's not working?  Are there errors?  Javascript console give any clues?