From cb887eab900528ef7c32b7707021851f7f574f3f Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 6 Nov 2018 14:32:02 +0100 Subject: [PATCH] * Api: fix radiobox not return current selected value but the first value --- api/js/etemplate/et2_widget_radiobox.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_widget_radiobox.js b/api/js/etemplate/et2_widget_radiobox.js index fa3d642db1..9736fe66ec 100644 --- a/api/js/etemplate/et2_widget_radiobox.js +++ b/api/js/etemplate/et2_widget_radiobox.js @@ -132,15 +132,17 @@ var et2_radiobox = (function(){ "use strict"; return et2_inputWidget.extend( getValue: function() { var val = this.options.value; // initial value, when form is loaded + var values = []; this.getRoot().iterateOver(function(radio) { + values.push(radio.options.set_value); if (radio.id == this.id && radio.input && radio.input.prop('checked')) { val = radio.options.set_value; } }, this, et2_radiobox); - return val == this.options.set_value ? this.options.set_value : null; + return val.indexOf(values) ? val : null; }, /**