Etemplate - allow onchange for customfields

This commit is contained in:
nathangray 2019-02-25 10:48:46 -07:00
parent cbbd3e2cd8
commit 881f056c3c

View File

@ -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;