From ad1778be9ce4ccbb05aad6b962205233f6bb3c62 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 25 Feb 2019 10:48:46 -0700 Subject: [PATCH] Etemplate - allow onchange for customfields --- api/js/etemplate/et2_extension_customfields.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/api/js/etemplate/et2_extension_customfields.js b/api/js/etemplate/et2_extension_customfields.js index 5bdbd1daaf..3ae6fe6ecd 100644 --- a/api/js/etemplate/et2_extension_customfields.js +++ b/api/js/etemplate/et2_extension_customfields.js @@ -53,6 +53,13 @@ var et2_customfields_list = (function(){ "use strict"; return et2_valueWidget.ex 'name': 'sub app name', 'type': "string", 'description': "Name of sub application" + }, + // Allow onchange so you can put handlers on the sub-widgets + 'onchange': { + "name": "onchange", + "type": "string", + "default": et2_no_init, + "description": "JS code which is executed when the value changes." } }, @@ -209,6 +216,11 @@ var et2_customfields_list = (function(){ "use strict"; return et2_valueWidget.ex // Can't have a required readonly, it will warn & be removed later, so avoid the warning if(attrs.readonly === true) delete attrs.needed; + if(this.options.onchange) + { + attrs.onchange = this.options.onchange; + } + if(this[setup_function]) { var no_skip = this[setup_function].call(this, field_name, field, attrs); if(!no_skip) continue;