From: Coleman Watts Date: Mon, 23 Aug 2021 20:21:41 +0000 (-0400) Subject: Afform - Fix setting default value X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b534017eb8fb14996bd60d13e0ea0e893c32f412;p=civicrm-core.git Afform - Fix setting default value String comparison was failing for integer keys. --- diff --git a/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js b/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js index b20511ae61..2cc5e04a7d 100644 --- a/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js +++ b/ext/afform/admin/ang/afGuiEditor/elements/afGuiField.component.js @@ -236,11 +236,13 @@ }; $scope.defaultValueContains = function(val) { + val = '' + val; var defaultVal = getSet('afform_default'); return defaultVal === val || (_.isArray(defaultVal) && _.includes(defaultVal, val)); }; $scope.toggleDefaultValueItem = function(val) { + val = '' + val; if (defaultValueShouldBeArray()) { if (!_.isArray(getSet('afform_default'))) { ctrl.node.defn.afform_default = []; diff --git a/ext/afform/admin/ang/afGuiEditor/inputType/Select.html b/ext/afform/admin/ang/afGuiEditor/inputType/Select.html index 33dd6f932b..1f5e849f20 100644 --- a/ext/afform/admin/ang/afGuiEditor/inputType/Select.html +++ b/ext/afform/admin/ang/afGuiEditor/inputType/Select.html @@ -6,6 +6,9 @@