I need to set data from HTML Component in a variable of Klipfolio using javascript as I am using a plugin for multiple selection from a dropdown box. I couldn't find any way to do that.
I tried with "set" method and other method, but it didn't work out for me.
In programming, just like in algebra, we use variables in expressions (total = price1 + price2). From the example above, you can calculate the total to be 11. JavaScript variables are containers for storing data values. All JavaScript variables must be identified with unique names. These unique names are called identifiers.
Here is an example of how you can create a script to display and change the --blue variable from the example used in the previous pages. For now, do not worry if you are not familiar with JavaScript. You can learn more about JavaScript in our JavaScript Tutorial:
To create a variable at any scope from the request builder, select the data you need, for example in the address, parameters, headers, or body. Choose Set as variable > Set as a new variable. Enter a Name, verify the Value and select a scope from the drop-down list. Click Set variable.
JavaScript Identifiers All JavaScript variables must be identified with unique names. These unique names are called identifiers. Identifiers can be short names (like x and y) or more descriptive names (age, sum, totalVolume).
The dashboard has a function on it called "setDashboardProp". This function takes the following inputs:
So to set a tab scope variable named currentMax to 10 use the following call:
dashboard.setDashboardProp(2,"currentMax",10,dashboard.activeTab.id);
Check that value was set using getDashboardProp:
dashboard.getDashboardProp("currentMax",2,dashboard.activeTab.id);
I would suggest using the browser console in developer tools in either Chrome or Firefox to test out these calls before including in a Klip.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With