• Resolved martymcleod

    (@martymcleod)


    Hi! I’ve searched but had no luck finding an answer. I was hoping to define “global ” constants (global to a single form, to be used by fields for calculations).

    I created an HTML element in the (top of) form and tried this:

    <script> const CONST_CNF_CAP = 0.03003, CONST_LNF_IND = 0.02252, CONST_RZ_RES = 1.25;
    </script>

    And then within a field, for example, attempted to use it like so:
    (function(){
    var result;
    result = CONST_CNF_CAP/fieldname14;
    return PREC(result*1000000,1);
    })()

    …with no success. Is it possible to do this in a form?

    Thank you! ??

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @martymcleod,

    The “const” declaration declares block-scoped local variables. Please use “var” instead:

    <script> var CONST_CNF_CAP = 0.03003, CONST_LNF_IND = 0.02252, CONST_RZ_RES = 1.25;</script>b

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Global Constants Are Possible?’ is closed to new replies.