I have this form-
@using (Html.BeginForm("SaveVideo", "Upload", FormMethod.Post, new { id = "form-upload", @Class = "form-horizontal", enctype = "multipart/form-data", onsubmit = "return tags()", genres = "return genres()" }))
{
}
where on form submit I will need to send strings seperated by comma.
<script type="text/javascript">
function genres() {
var genres = $('#input-genreautocomplete').val();
return genres;
}
function tags() {
var tags = $('#input-tagautocomplete').val();
return tags;
</script>
Now as an example genre would be like- 23,15,16,22,11 as same as tags is. It return me string seperated by comma.
Now I want to use these strings in my method SaveVideo . But I can't get these strings working as parameters. How Do I send these strings on method?
Autocompletes working like this-
<script type="text/javascript">
$(function () {
$('#input-tagautocomplete').tagsinput({
itemValue: 'Id',
itemText: 'TagName',
typeahead: {
source: function (term, process) {
items = [];
map = {};
idofitem = [];
var url = "@Url.Content("~/Upload/GetTagNames/")";
return $.getJSON(url, { term: term }, function (data) {
$.each(data, function (i, item) {
map[item] = item;
items.push(item.TagName);
});
return (items);
});
},
updater: function (item) {
var selected = map[item].Id;
$('#tag-value').val(selected);
return item;
}
}
});
});
</script>
Where updater is not working, though it's bootstrap's typeahead's extension.
#input-genreautocompleteand#input-tagautocompleteelements are created?