From 9be49f4faf6891096218f6ff9e29722e1e7466c7 Mon Sep 17 00:00:00 2001 From: James Graham Date: Mon, 15 Feb 2021 19:13:14 +0000 Subject: [PATCH] fix: accept any option starting with 'other' See #75 --- people/templates/people/person/update.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/people/templates/people/person/update.html b/people/templates/people/person/update.html index d4b3fce..0ed58a9 100644 --- a/people/templates/people/person/update.html +++ b/people/templates/people/person/update.html @@ -55,14 +55,14 @@ function hasOption(select, option) { var exists = false; for (var i = 0; i < select.options.length; i++) { - if (select.options[i].text === option) return true; + if (select.options[i].text.toLowerCase().startsWith(option)) return true; } return false; } function setFreeTextState(select, freeTextField) { - if (select.selectedOptions[0].text === 'Other') { + if (select.selectedOptions[0].text.toLowerCase().startsWith('other')) { freeTextField.show(); } else { freeTextField.hide(); @@ -71,7 +71,7 @@ $(document).ready(function(){ $('select').each(function(index, element) { - if (hasOption(element, 'Other')) { + if (hasOption(element, 'other')) { var freeTextField = $('#' + element.id + '_free').parent(); setFreeTextState(element, freeTextField);