In my use case I am using tag tag-it to get tags from user. I am getting the tags input in html <ul>
form. I am using golang in server side.
html:
<form class="comment-form" action="/add/" method="POST" enctype="multipart/form-data">
<div class="form-input">
<label for="tags_label">Tags</label>
<ul id="tags">
<script type="text/javascript">
$("#myTags").tagit();
var tagsArray = ["C", "C++", "Go", "Ruby"];
$("#tags").tagit({
itemName: "teamId",
fieldName: "teamName",
availableTags: tagsArray,
allowSpaces:true,
caseSensitive:false,
removeConfirmation:true,
placeholderText:"Tags",
tagLimit: 5,
allowDuplicates: false,
singleFieldDelimiter: ',',
onlyAvailableTags: false
});
</script>
</ul>
</div>
</form>
and in server end I am trying to get the value like below similar to other fields in the form,
tags := r.FormValue("tags")
log.Printf("Tags : ", tags)
But it is not working. Could someone help me with this?
EDIT: When I inspect the element this is what I see,
<div class="form-input">
<label for="tags_label">Tags</label>
<ul id="tags" class="tagit ui-widget ui-widget-content ui-corner-all">
<script type="text/javascript">
$("#myTags").tagit();
var tagsArray = ["C", "C++", "Go", "Ruby"];
$("#tags").tagit({
itemName: "teamId",
fieldName: "teamName",
availableTags: tagsArray,
allowSpaces:true,
caseSensitive:false,
removeConfirmation:true,
placeholderText:"Tags",
tagLimit: 5,
allowDuplicates: false,
singleFieldDelimiter: ',',
onlyAvailableTags: false
});
</script><li class="tagit-new"><input type="text" class="ui-widget-content ui-autocomplete-input" placeholder="Tags" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true"></li>
</ul>
</div>