Recent Topics

autocomplete tags (help required from javascript guru)

Started by on Jul 30, 2008 – Contents updated: Jul 30, 2008

Jul 30, 2008 17:40    

I'm writing a plugin that will autocomplete tags as you write them when you edit a post. So, if you have already existing tags, let's say "economics", "ecology", "ecologists" and you start to write "eco" in the tags input field, you will get a menu with all the possible tags, in this example (3) but potentially many.

I think this is very handy when you have more than a few dozen tags, because sometimes you don't remember all of them.

So, I have already a prototype working that sort of does what I want. But as you can see in the screenshot, the autocompletion list appears in one corner of the browser, when it should appear below the tags input field.

At this point I don't know how to put the thing in the right position, which it happens in the demo:

If you're a javascript guru, or at least know more javascript than me, then you can downloade a zip file with the current plugin code [url=]from here[/url] and give it a try to see if you can pinpoint the error (if you have firebug, the javascript code will call the debugger where I believe is the error).

The second part of the plugin, which I haven't written yet, will update the list of tags automatically or something, I haven't thought it out carefully, since I couldn't overcome this problem with a static list (in file autocomplete_tags_plugin/wick_0.1/sample_data.js), but I will if I manage to solve it... with a little help from my friends :)

Jul 30, 2008 18:41

Oh, Nein! One day lost for not looking before starting to code :(

On the other hand, I'll give it a try and see how it works.

Jul 30, 2008 20:03

Hi Austriaco,

Don't get disappointed to much. I had the same with the Sorted Bloglist plugin and that still lives happily side by side with some AM thing.

I looked at your code. Please do use require_js and require_css and add_headline for the code in the header:


function AdminEndHtmlHead( & $params )
    $the_url $this->get_plugin_urltrue );
    require_js$the_url 'wick_0.1/sample_data.js'true );
    require_css$the_url 'wick_0.1/wick.css'true );
    return true;

Check those functions in the docs.

To solve your problem with the float change lines 212 and 213 in wick.js to:

PHP x+'px'; y+'px';

I'd say it's a Gecko bug. If no dimensions are provided px is presumed. So don't ask me why this occured.

Anyway nice job.
Good luck and have fun

Jul 30, 2008 20:16

Ahhh mate, yer months behind, try and keep up :roll:

Now I'm gonna have to go download your code and have a nosey :p


Aug 06, 2008 15:59

Thanks Afwas, that in fact corrects the problem. I'll release the plugin anyway someday and see if anybody likes it more than the AM Predicting Tags :)

Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.