diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml b/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml index dddfe43ea..e9aa0ce69 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml +++ b/AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml @@ -165,7 +165,7 @@
-

You can enter a maximum of 50 characters

+

You can enter a maximum of 50 characters per keyword.

@{ var i = 0; @@ -334,29 +334,31 @@ }); $('#add-keyword').on('click', function () { - var $keywordInput = $('#add-keyword-input'); - var value = $keywordInput.val(); - if (!value) { - return; - } - value = value.trim(); - if (keywords.indexOf(value) === -1) { - keywords.push(value); - $('#Keywords').val(keywords); - var tag = $('

' + value + '

'); - tag.find('.fa-times').on('click', removeKeyword); - $('.keyword-list').append(tag); - $keywordInput.val(""); - // reindex the keyword inputs - $('.keyword-value').each(function (i, x) { - $(x).attr('name', "Keywords[" + i + "]"); - }); - } - if (keywords.length > 4) { - $('#add-keyword').attr('disabled', 'disabled'); - $('#add-keyword-input').attr('disabled', 'disabled'); + var $keywordInput = $('#add-keyword-input'); + var value = $keywordInput.val(); + if (!value) { + return; + } + + // Split the input value by commas and trim each keyword + var values = value.split(',').map(function (item) { + return item.trim(); + }); + + values.forEach(function (value) { + if (value && keywords.indexOf(value) === -1) { + keywords.push(value); + $('#Keywords').val(keywords); + var tag = $('

' + value + '

'); + tag.find('.fa-times').on('click', removeKeyword); + $('.keyword-list').append(tag); + + // reindex the keyword inputs + $('.keyword-value').each(function (i, x) { + $(x).attr('name', "Keywords[" + i + "]"); + }); } - }); + }); // url var oldUrl = ""; diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue index 06d704f18..70462257c 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue @@ -90,11 +90,11 @@ To help learners find this resource, type one or more relevant keywords separated by commas and click 'Add'.
- +
@@ -529,7 +529,7 @@ if (!this.keywords.find(_keyword => allTrimmedKeyword.includes(_keyword.keyword.toLowerCase()))) { for (var i = 0; i < allTrimmedKeyword.length; i++) { let item = allTrimmedKeyword[i]; - if (item.length > 0) { + if (item.length > 0 && item.length <= 50) { let newkeywordObj = new KeywordModel(); newkeywordObj.keyword = item; newkeywordObj.resourceVersionId = this.resourceDetail.resourceVersionId;