From ced0e0787ea02887040dacc745d0d839bd0713ad Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 29 Mar 2012 22:41:54 +0000 Subject: [PATCH] Implement form::name() pseudo function --- etemplate/js/et2_core_legacyJSFunctions.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/etemplate/js/et2_core_legacyJSFunctions.js b/etemplate/js/et2_core_legacyJSFunctions.js index 96d77b310b..d4772c2377 100644 --- a/etemplate/js/et2_core_legacyJSFunctions.js +++ b/etemplate/js/et2_core_legacyJSFunctions.js @@ -32,7 +32,7 @@ * @param string _cname name-prefix / name-space * @return string */ - function js_pseudo_funcs(_val) + function js_pseudo_funcs(_val,widget) { if (_val.indexOf('egw::link(') != -1) { @@ -41,8 +41,9 @@ if (_val.indexOf('form::name(') != -1) { - // XXX Use the widget reference XXX - //_val = _val.replace(/form::name\(/g,_cname ? "et2_form_name('"+_cname+"'," : '('); + // et2_form_name doesn't care about ][, just [ + var _cname = widget.getPath() ? widget.getPath().join("[") : false; + _val = _val.replace(/form::name\(/g,_cname ? "et2_form_name('"+_cname+"'," : '('); } if (_val.indexOf('egw::lang(') != -1) @@ -87,7 +88,7 @@ this.et2_compileLegacyJS = function(_code, _widget, _context) { // Replace the javascript pseudo-functions - _code = js_pseudo_funcs(_code); + _code = js_pseudo_funcs(_code,_widget); // Check whether _code is simply "1" -- if yes replace it accordingly if (_code === '1')