I am using auto completion for one of my field

var tags1 = {!jsonDescriptionData1};
$( "#autocomplete1" ).autocomplete({
  source: function( request, response ) {
          var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( request.term ), "i" );
          response( $.grep( tags1, function( item ){
              return matcher.test( item );
          }) );

Vf code :

   <apex:inputText value="{!inputText1}" id="autocomplete1" />

It is not showing auto completion.but i can get the value to controller.

html code:

<input type="text" Value="{!inputText1}"  id="autocomplete1"/>

It is showing auto completion .but i cant able to get the value to controller.

  • can you provide your controller code once. – Sathya Feb 10 '14 at 7:54
  • public String inputText1{get;set;} if(inputText1<>''){ query +=' WHERE ' + input1 + ' ' + operator + ' : inputText1' ; } – Teja Feb 10 '14 at 8:25

The problem is the ID value used in the selector is not the ID that is generated for the apex:inputText component. You can see the actual ID if you view the source of your page.


$( "#autocomplete1" )

to use a partial selector.

$( "input[id$=autocomplete1]" )

You can still use apex:inputText if you do that.

Alternatively you can use the $Component global variable to build the exact ID, but if you change the page structure you may have to change it.

| improve this answer | |

Use apex:inputText instead of pure html input box, it seems that your autocomplete1 value is not appearing in form data.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.