SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Autocompleter using javascript php

    Now i am using joomla as php CMS... I have to include an autocompleter in the form. Now thing is i have an array already stored with the values that i want to be shown in autocompleter...
    So is it possible to have an autocompleter on php textbox which fetches values from array...

    I tried search but all uses autocompleter fetching data from database but i hv already got the data in array... So just a javascript should suffice..

    Please guide with tutorial or link to example with script or any suggestion which can help fulfill my requirement.....

    Thank you

  2. #2
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Are you using jQuery? If so, it's quite easy:

    Code javascript:
     
    	<script>
    	$(function() {
    		// this would be your array of data
    		var availableTags = [
    			"ActionScript",
    			"AppleScript",
    			"Asp",
    			"BASIC",
    			"C",
    			"C++",
    			"Clojure",
    			"COBOL",
    			"ColdFusion",
    			"Erlang",
    			"Fortran",
    			"Groovy",
    			"Haskell",
    			"Java",
    			"JavaScript",
    			"Lisp",
    			"Perl",
    			"PHP",
    			"Python",
    			"Ruby",
    			"Scala",
    			"Scheme"
    		];
    		// this is the input that you want the autocomplete to work on
    		$( "#tags" ).autocomplete({
    			source: availableTags
    		});
    	});
    	</script>

    If you're not using jQuery, it's still not too difficult, but it'll require some more work.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank YOu for the prompt reply.....

    Well as such i am working on php CMS(Joomla) it uses mootools and using jquery with mootools did conflicted couple of times.

    I tried this autocompleter with mootools
    ( AutoCompleter digitarald:Harald Kirschner )
    Above linked script runs fine when executed alone but when i include it inside the joomla website folder it stops workings....so i started looking after a solution with Javascript only


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •