Copy link to clipboard
Copied
I have a simple line of code (on button click) to get s string from a text entry box and input it into a variable value:
var fillCount= document.getElementById('Text_Entry_Box_1_1_inputField').value;
This works fine if the button is on the same slide, but doesn't work from a different slide. Any suggestions? Thanks.
That's because the element is no longer rendered in the window (DOM). You are probably getting a can't access property of an undefined object error.
Assign that value to a variable and then you can always access it.
Copy link to clipboard
Copied
That's because the element is no longer rendered in the window (DOM). You are probably getting a can't access property of an undefined object error.
Assign that value to a variable and then you can always access it.
Copy link to clipboard
Copied
That value is in a variable, why do you have to assign it to another var?
Copy link to clipboard
Copied
Lieve,
While what you say is correct, I think Dave was talking about a JavaScript variable, not the Associated Variable of the TEB.
If the OP is trying to do ALL of this via JS then they'd have to do as Dave suggested and create a JS variable to store the value from the TEB for later use. If they are happy to change the code to just reference the associated user variable then your suggestion would be fine as well.
Copy link to clipboard
Copied
Thanks, Rod, I understand. You have to us getVariableValue on the slide of the TEB to store that value in a JS variable which is globally available, also on later slides. I wonder how the advanced actions, which do have access to those TEB-variables on all slides, are 'translated' in JS
Copy link to clipboard
Copied
Thanks!
Copy link to clipboard
Copied
While I'm now able to access the text entry box value from a 2nd slide (and that's great), is there a way to reverse this and change the text entry value from another slide?