From f032946af9249703d829d4470e8d27b514682da1 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 1 Jun 2022 15:11:46 -0400 Subject: [PATCH] Afform - allow ids to be passed directly into the directive not just through the URL This gives Submit Forms the same feature as Search Forms, entity ids can be passed directly into the directive as 'options', allowing ids to be passed around internally. --- ext/afform/core/ang/af/afForm.component.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/afform/core/ang/af/afForm.component.js b/ext/afform/core/ang/af/afForm.component.js index 888953f499..972e78b9b2 100644 --- a/ext/afform/core/ang/af/afForm.component.js +++ b/ext/afform/core/ang/af/afForm.component.js @@ -8,6 +8,7 @@ var schema = {}, data = {}, status, + args, ctrl = this; this.$onInit = function() { @@ -36,8 +37,8 @@ return $scope.$parent.meta; }; this.loadData = function() { - var toLoad = 0, - args = $scope.$parent.routeParams || {}; + var toLoad = 0; + args = _.assign({}, $scope.$parent.routeParams || {}, $scope.$parent.options || {}); _.each(schema, function(entity, entityName) { if (args[entityName] || entity.autofill) { toLoad++; @@ -88,7 +89,7 @@ crmApi4('Afform', 'submit', { name: ctrl.getFormMeta().name, - args: $scope.$parent.routeParams || {}, + args: args, values: data} ).then(function(response) { if (ctrl.fileUploader.getNotUploadedItems().length) { -- 2.25.1