• Resolved maxshash

    (@maxshash)


    Hello,

    How can I pass the value from the global var from the shortcode as a predefined value?

    My steps

    1. I’m passing the value from the global variable in shortcode like this:
    [CP_CALCULATED_FIELDS id="6" testvar="105"]
    See here https://i.imgur.com/PVgAr2U.png

    2. Then I use testvar as a Predefined Value for fieldname2.
    See here https://i.imgur.com/v5RC12X.png

    3. I expect the value by default will be 105 and the calculated field will show 105*2. However, on the page I see “testvar” and not “105” in that field. See here https://i.imgur.com/Ir3joQe.png

    Please help to figure it out.

    Thanks!

    • This topic was modified 3 years, 9 months ago by maxshash.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @maxshash

    Thank you very much for using our plugin. Our plugin does not accept you to enter a variable name as the predefined value of the field because it creates ambiguity. The plugin cannot identify if you want to include the variable name or plain text with the variable name.

    So, you have three alternatives.

    1. You can use the Calculated Field for the fieldname2. You could configure it as editable by unticking the “read-only” checkbox in its settings. The field’s equation would be:

    testvar

    2. You can use an additional calculated field as an auxiliary to fill the fieldname2 field. You can hide the new field by ticking a checkbox in its settings. The equation of the field would be:

    getField(2).setVal(testvar);

    3. You can fill the fieldname2 field from an “HTML Content” field. Insert an “HTML Content” field in the form and enter the following piece of code as its content:

    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    getField(2).setVal(testvar);
    });
    </script>

    Best regards.

    Thread Starter maxshash

    (@maxshash)

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to populate Predefined Value from Global Variable?’ is closed to new replies.