I am trying to write tag elements in the body with selected tags from a autocomplete field, it works currently but only if a existing value is selected. I would also like it to add a value if it does not exists yet in the database so i can save it togheter with the article..

Can anybody explain to me how i can submit values even if they are not from the list?

This is the function that is called..

Code:
// Function to add tags
function addTags(text, li)
{
        //Create a DIV
        var div = document.createElement('div');
        //Fill in the DIV with the object infos
        div.innerHTML = li.innerHTML;
        // Set id 
        div.id = li.id;
        //Some styling
        div.style.border = '1px solid #CCC';
        div.style.margin = '5px';
        div.style.cursor = 'pointer';
        
        document.getElementById('groupTags').appendChild(div);
}
And in CakePHP i use this for the autocomplete field..

PHP Code:
    <?php echo $ajax->autocomplete('Tag/tag',
    
'/articles/autocompleteTags',
    array(
'size' => 40'afterUpdateElement'=>'addTags''indicator' => 'spinner')
    );
    
?>
    <span id="spinner" style="display: none;"><img src="<?php echo $this->webroot?>/img/spinner.gif" alt="Working..." /></span>