Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Why can't I access text entry box value in Javascript from another slide?

Explorer ,
Nov 22, 2016 Nov 22, 2016

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.

400
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Nov 22, 2016 Nov 22, 2016

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.

Translate
People's Champ ,
Nov 22, 2016 Nov 22, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2016 Nov 22, 2016

That value is in a variable, why do you have to assign it to another var?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2016 Nov 22, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 23, 2016 Nov 23, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 25, 2016 Nov 25, 2016

Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 25, 2016 Nov 25, 2016
LATEST

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources