Frage

I'm using tagit with autocomplete and I'd like to populate my tags list with the current tags when editing an item.

I also have it configured to save the Id of the tag in a hidden input field upon selection and this hidden input is currently populated with the tag Id's of the current item being edited.

How exactly do I set the initial values on the tag editor?

War es hilfreich?

Lösung 2

To solve this problem I changed to use the standard tag names rather than ID's in the hidden input field.

This means I have to get the tag IDs from the db upon submission but it doesn't appear to be a huge overhead.

Andere Tipps

EDIT : after reading your question again, this probably won't work for you since you are populating your input with ids, not tags.

I'm not sure about the storing the id part, but this is how you load a page with initial values:

<input 
    id="tags_input" 
    type="hidden" 
    name="tags_input" 
    value="<!--put comma delimited tags in here-->">
<ul id="tags"></ul>

I assume that the data is stored in some way in the input box when you have more than just the tag name. Use firebug to see what is being put in there, then load a page with the input having what tag-it put in there.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top