From 8b494905285c78dd1b0f37337cac1f63c1d9503f Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 9 Apr 2012 21:23:05 +0000 Subject: [PATCH] Implement legacy options --- etemplate/js/et2_widget_checkbox.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/etemplate/js/et2_widget_checkbox.js b/etemplate/js/et2_widget_checkbox.js index 6f3cb4d209..62df6797bf 100644 --- a/etemplate/js/et2_widget_checkbox.js +++ b/etemplate/js/et2_widget_checkbox.js @@ -47,9 +47,15 @@ var et2_checkbox = et2_inputWidget.extend({ "type": "string", "default": "", "description": "What should be displayed when readonly and not selected" + }, + "value": { + // Stop framework from messing with value + "type": "any" } }, + legacyOptions: ["selected_value", "unselected_value", "ro_true", "ro_false"], + init: function() { this._super.apply(this, arguments); @@ -73,7 +79,8 @@ var et2_checkbox = et2_inputWidget.extend({ */ set_value: function(_value) { if(_value != this.value) { - if(_value == this.options.selected_value) { + if(_value == this.options.selected_value || + _value && this.options.selected_value == this.__proto__.attributes.selected_value["default"]) { this.input.attr("checked", "checked"); } else { this.input.removeAttr("checked");