Hello everyone, I'm trying to run a Javascript function that encrypts the values from a textbox and display the output on another input / data label for starters, I've attempted several methods and previous solutions from past posts but none works as the function just doesn't run on k2.
I cannot figure out how to make the function run and display the result. I feel like I'm missing something somewhere.
Any help or pointers would be very much appreciated.
Thanks
Best answer by ernie_hayter
Hi
I was able to get this working just fine. Here's a breakdown of what I did:
Add a data label to the canvas with Literal = true and Prevent XSS = false
Add 2 text boxes, a button and another data label (Literal = true, Prevent XSS = false)
On button click transfer this to the second data label: <script>var encryptedValue = CryptoJS.AES.encrypt("data", "<<Map your Text Box>>").toString(); $("[name='<<Name of Result Text Box>>']").SFCTextBox("option", "text", encryptedValue)</script>
If you are planning on running this same code multiple times, add an OnChange rule to the second data label that will just empty its own value, that way the code will evaluate multiple times
Add 2 text boxes, a button and another data label (Literal = true, Prevent XSS = false)
On button click transfer this to the second data label: <script>var encryptedValue = CryptoJS.AES.encrypt("data", "<<Map your Text Box>>").toString(); $("[name='<<Name of Result Text Box>>']").SFCTextBox("option", "text", encryptedValue)</script>
If you are planning on running this same code multiple times, add an OnChange rule to the second data label that will just empty its own value, that way the code will evaluate multiple times