diff --git a/public/form.js b/public/form.js index 5f42c9f..889fbb3 100644 --- a/public/form.js +++ b/public/form.js @@ -656,7 +656,17 @@ ocForm.showLine = function(selectedValues, line, keys, widgets, canHide, separat } } } - + // After variable substitution, replace the $[[ ]] section with the calculated result. + line = line.replace(/\$\[\[(.*?)\]\]/g, (_, expr) => { + try { + // Return calculation result + return eval(expr); + } catch (e) { + // Nothing to do + return `$[[${expr}]]`; + } + }); + if (line) { selectedValues.push(line); }