From 12f15a0a5a3d6cc95a37da48d3e422b295494dcd Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 1 Aug 2017 13:12:45 -0600 Subject: [PATCH] Allow to disable individual radioboxes when they all share the same ID by using their value --- api/js/etemplate/et2_widget_radiobox.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_widget_radiobox.js b/api/js/etemplate/et2_widget_radiobox.js index 5a044f1648..6fc98b137d 100644 --- a/api/js/etemplate/et2_widget_radiobox.js +++ b/api/js/etemplate/et2_widget_radiobox.js @@ -62,11 +62,20 @@ var et2_radiobox = (function(){ "use strict"; return et2_inputWidget.extend( this.createInputWidget(); }, + transformAttributes: function(_attrs) { + this._super.apply(this, arguments); + var readonly = this.getArrayMgr('readonlys').getEntry(this.id); + if(readonly && readonly[_attrs.set_value]) + { + _attrs.readonly = readonly[_attrs.set_value]; + } + }, createInputWidget: function() { this.input = jQuery(document.createElement("input")) .val(this.options.set_value) - .attr("type", "radio"); + .attr("type", "radio") + .attr("disabled", this.options.readonly); this.input.addClass("et2_radiobox");