From 2db19b796dcd4cb33f2810e3b3c80c1545f000dd Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 24 Feb 2021 20:40:09 +1100 Subject: [PATCH] Afform: Only permit Date fields to be made into a select list if it is a search form --- .../admin/ang/afGuiEditor/elements/afGuiField.component.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js b/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js index 950722e495..c2215bee5e 100644 --- a/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js +++ b/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js @@ -26,6 +26,10 @@ $scope.meta = afGui.meta; }; + this.isSearch = function() { + return !_.isEmpty($scope.meta.searchDisplays); + }; + // Returns the original field definition from metadata this.getDefn = function() { var defn = afGui.getField(ctrl.container.getFieldEntityType(ctrl.node.name), ctrl.node.name); @@ -75,7 +79,7 @@ return defn.options || defn.data_type === 'Boolean'; case 'Select': - return defn.options || defn.data_type === 'Boolean' || defn.input_type === 'Date'; + return defn.options || defn.data_type === 'Boolean' || (defn.input_type === 'Date' && ctrl.isSearch()); case 'Date': return defn.input_type === 'Date'; -- 2.25.1