SitePoint Sponsor |
|
User Tag List
Results 1 to 1 of 1
Thread: Scriptaculous autocomplete?
-
Jul 1, 2007, 09:23 #1
- Join Date
- Jul 2004
- Location
- Netherlands
- Posts
- 672
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Scriptaculous autocomplete?
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); }
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>Go visit my site :-D you know you want to ;-)
www.mech7.net
Bookmarks