Forums

JQuery Autocomplete

cesarvelame 12 Jun, 2014
I can´t apply the autocomplete in a form like this http://jsfiddle.net/jensbits/PekQZ/light/

I know that Chronoforms has an Autocomplete Action but I need to use XML as source.

When I reproduce the same code form example, the autocomplete doesn´t work.

Any suggestions?
cesarvelame 12 Jun, 2014
This code doesn´t work:

  $(function() {
    var availableTags = [
      "ActionScript",
      "AppleScript",
      "Asp",
      "BASIC",
      "C",
      "C++",
      "Clojure",
      "COBOL",
      "ColdFusion",
      "Erlang",
      "Fortran",
      "Groovy",
      "Haskell",
      "Java",
      "JavaScript",
      "Lisp",
      "Perl",
      "PHP",
      "Python",
      "Ruby",
      "Scala",
      "Scheme"
    ];
    $( "#tags" ).autocomplete({
      source: availableTags
    });
  });


Source: http://jqueryui.com/autocomplete/
GreyHead 13 Jun, 2014
Hi cesarvelame,

It looks as though it ought to work OK assuming that the widget is in the jQuery library on your site. Do you see any errors? Where exactly have you put this code?

Bob
rmpaolillo 14 Mar, 2015
Hi Bob,

I am stuck with the same issue.

The form is very simple.

1) A custom code (pure code) in the designer:
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags">
</div>


2) A "load javascript" in the on-load event:


$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});


As you said, this should work OK siince the

jQuery

libraries are loaded, but no success.

http://5.249.148.62/index.php?option=com_chronoforms5&chronoform=autocomplete_simple_example

Same issue if I try to make this in CCv5 (I have another open question related to this).

Hope this help.

Marco
rmpaolillo 21 Mar, 2015
Solved.

Keep in my I am using the latest CFv5 and the latest Joomla 2.5.

In the "on load" event a inserted a custom code.

<?php
if(!JFactory::getApplication()->get('jquery'))
{
    JFactory::getApplication()->set('jquery',true);
    $doc = JFactory::getDocument();
    $doc->addScript('http://code.jquery.com/jquery-1.10.2.js');
    $doc->addScript('http://code.jquery.com/ui/1.11.4/jquery-ui.js');
}
?>


and it loads as expected.
This topic is locked and no more replies can be posted.