diff --git a/metadata-generator.html b/metadata-generator.html index 79fbd9a..e978f72 100644 --- a/metadata-generator.html +++ b/metadata-generator.html @@ -491,6 +491,18 @@ $('.selectpicker').selectpicker('refresh'); } + function changeOrganizationType(creatorListItem, type) { + const organizationElements = creatorListItem.getElementsByClassName("inputOrganization") + for (const element of organizationElements) { + if (element.classList.contains("customOrganization")) { + element.disabled = type !== "custom"; + } else { + element.disabled = type === "custom"; + } + } + $('.selectpicker').selectpicker('refresh'); + } + function addCreator(firstName = "", lastName = "", authorId = "", institution = "", organizationName = "", type = "Person", affiliationName = "") { const creatorList = document.getElementById("creator-list"); const item = document.createElement("li"); @@ -502,6 +514,7 @@ organizationOptions += ''; }); let customInstitutionSelected = institution === "" && affiliationName !== ""; + let customOrganizationSelected = institution === "" && organizationName !== ""; let radioGroupName = creatorList.childElementCount > 1 ? $(creatorList.lastElementChild.previousElementSibling).find('.inputType').find('input').attr('name') : '' radioGroupName += 'x' @@ -555,14 +568,28 @@ -