jQuery Autocomplete: saving new tags to a database

536 views Asked by At

I'm a noob in this kind of field, but I hope I'll find an answer here. I'm trying to implement a tagging system for storing images to a dabatase. The user is given the chance to upload a new image, adding a little description and (here it comes the difficult part for me) adding tags to it. I've found quite good documentations aboout using jQuery Autocomplete to read already existing tags from a DB. However, I need also the opportunity to check if a tag already exists and, if not, to add it do my DB. Could someone please give me an hand on my quest?

Long story short: I need to use jQuery Autocomplete (or any equivalent plugin) for both "getting from" and "saving to" tags to a database.

Thank you. :)

EDIT: this is the form I'm planning to use to insert my tags (and the description). I've already implemented two jQuery functions to limit the max number of chars in the "description" textarea and the max number of words in the "tags" one.

<form method="post" action="/upload" accept-charset="UTF-8">
  <div>
    <label>Descrizione:</label>
    <textarea id="description" maxlength="240"></textarea>
    <div id="leftChars"></div>
    <hr>
    <label>Tag:</label>
    <textarea id="tags" maxlength="240"></textarea>
    <div id="leftTags"></div>
  </div>
  <br>
  <input class="btn btn-default btn-upload" type="button" value="Upload" onclick="">
</form>
0

There are 0 answers