From 0a48696cd88dc8a0711e0bed430a77669134dfa7 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 30 Apr 2019 15:46:44 +0200 Subject: [PATCH] =?UTF-8?q?Carbon:=20N=C2=B01855=20-=20Fix:=20Cannot=20rem?= =?UTF-8?q?ove=20last=20'dependencies'=20with=20UI=20Note=20that=20multi-s?= =?UTF-8?q?elect=20value=20when=20no=20entry=20is=20selected=20is=20""=20a?= =?UTF-8?q?nd=20not=20[]=20in=20order=20to=20be=20posted,=20so=20multi-sel?= =?UTF-8?q?ect=20values=20are=20not=20always=20arrays.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/property_field.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/property_field.js b/js/property_field.js index 5512d28da..6e79589c6 100644 --- a/js/property_field.js +++ b/js/property_field.js @@ -256,14 +256,14 @@ $(function() if (oWidget && oWidget._is_visible()) { var oVal = oWidget._get_committed_value(); - oData[oVal.name] = oVal.value; + oData[oVal.name] = me._get_value_for_post(oVal.value); } }); var oPostedData = this.options.submit_parameters; oPostedData.params = oData; oPostedData.params.updated = [ $('#'+this.options.field_id, this.element).attr('name') ]; // only one field updated in this case oPostedData.params.previous_values = {}; - oPostedData.params.previous_values[$('#'+this.options.field_id, this.element).attr('name')] = this.previous_value; // pass also the previous value(s) + oPostedData.params.previous_values[$('#'+this.options.field_id, this.element).attr('name')] = me._get_value_for_post(this.previous_value); // pass also the previous value(s) $.post(this.options.submit_to, oPostedData, function(data) { $('#prop_submit_result').html(data); @@ -293,6 +293,14 @@ $(function() oWidget = element.data('itopSelector_property_field'); } return oWidget; + }, + _get_value_for_post(value) + { + if ((typeof value == "object") && (Object.keys(value).length === 0)) + { + return ""; + } + return value; } }); });