From 15ddeb2a247d36ec5d853a4125537a72ada35728 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 7 Jul 2014 16:19:37 +0000 Subject: [PATCH] - Avoid duplicate ID warning by only returning the value from the matching radio button - Fix radiobuttons where the options/values were set in the template instead of sel_options --- etemplate/inc/class.etemplate_widget_checkbox.inc.php | 5 +++++ etemplate/js/et2_widget_radiobox.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/etemplate/inc/class.etemplate_widget_checkbox.inc.php b/etemplate/inc/class.etemplate_widget_checkbox.inc.php index 1c65ee0856..2f3216f6a3 100644 --- a/etemplate/inc/class.etemplate_widget_checkbox.inc.php +++ b/etemplate/inc/class.etemplate_widget_checkbox.inc.php @@ -79,6 +79,11 @@ class etemplate_widget_checkbox extends etemplate_widget { $valid = $value; } + elseif ( !$options && $selected_value && $value == $selected_value) + { + // Options set in template, not in sel_options + $valid = $selected_value; + } elseif (!isset($valid)) { $valid = ''; // do not overwrite value of an other radio-button of the same group (identical name)! diff --git a/etemplate/js/et2_widget_radiobox.js b/etemplate/js/et2_widget_radiobox.js index 89d0726c01..3a3236341d 100644 --- a/etemplate/js/et2_widget_radiobox.js +++ b/etemplate/js/et2_widget_radiobox.js @@ -133,7 +133,7 @@ var et2_radiobox = et2_inputWidget.extend( } }, this, et2_radiobox); - return val; + return val == this.options.set_value ? this.options.set_value : null; } }); et2_register_widget(et2_radiobox, ["radio"]);