Open rubenve opened 11 years ago
I don't know if this place is still alive, but if anyone ever needs something similar this is how I fixed it:
// Reset existing tags from tags textfield value if any
if ($("#newsitem\\[tags\\]").val().length > 0)
{
try
{
var tags = $.parseJSON($("#newsitem\\[tags\\]").val());
$("#newsitem\\[tags\\]").val('');
$("#newsitem\\[tags\\]").textext()[0].tags().addTags(tags);
}
catch (e) {}
}
I'm using TextExt in a ZF2 application to allow the user to tag news items. I'm using the ajax, tags and autocomplete plugins:
This all works fine and dandy except when the form doesn't validate and Zend Form automatically sets the values of the form elements to whatever was posted. In case of the tags element this means it populates it with something like ["tag1","tag2"] Is there a way I can force textext to parse the value of the element to make it show the value as tags? I think I would need to call the itemManager stringToItem method correct? Any help would be greatly appreciated.