From 04ad3651a4460200510be6d94221273efc762cf6 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 10 Oct 2023 15:23:19 -0600 Subject: [PATCH] Api: Let legacy custom JS return Legacy JS in the form app.appname.function where we _couldn't_ find the actual function now return. Fixes some custom click handlers couldn't submit --- api/js/etemplate/et2_core_legacyJSFunctions.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/js/etemplate/et2_core_legacyJSFunctions.ts b/api/js/etemplate/et2_core_legacyJSFunctions.ts index bcebaae590..4092b589cf 100644 --- a/api/js/etemplate/et2_core_legacyJSFunctions.ts +++ b/api/js/etemplate/et2_core_legacyJSFunctions.ts @@ -99,6 +99,11 @@ export function et2_compileLegacyJS(_code, _widget, _context) } // Code is app.appname.function, add the arguments so it can be executed _code += '(ev,widget)'; + // Return what the function returns + if(_code.indexOf("return") == -1) + { + _code = "return " + _code; + } } // use app object from etemplate2, which might be private and not just window.app _code = _code.replace(/(window\.)?app\./, 'widget.getInstanceManager().app_obj.');