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

Inject user variable into TEB

Explorer ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

I have an interesting request from a client. They would like the user to enter some data into a TEB on one slide then on the next slide that data pulls through to another TEB as the default text and allows them to edit it. This continues for a few slides as the user continuusly refines their text, each box capturing the edited text as a new variable.

 

Doesn't seem do-able with the default TEB tools but is there a JS solution that would achieve this?

 

Thanks

TOPICS
Advanced , Advanced actions

Views

980

Translate

Translate

Report

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

Advisor , Jun 29, 2021 Jun 29, 2021

You can achieve this with a couple lines of code in the onEnter action of your slide.

Each slide where a new TEB is located will need a slightly modified code because we need to address different named text boxes and reference different variables. I will provide the code for a transition from slide 1 to slide 2 as an example and hopefully you can see how to modify it for your own needs.

 

setTimeout(function() {
TEB2=TEB1;
document.getElementById("box2_inputField").value=TEB1;
},100);

 

Basically we

...

Votes

Translate

Translate
Community Expert ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

JS experts will provide you for a solution but there is an alternative.

You didn't tell if you need to score the TEB, it feels like it is a non-validated version. In that case, it would be easier to use the Scrolling Text interaction for your purpose. It can have an associated variable and has not the same limitations as the TEB. Here is a blog post explaining this interaction:

http://blog.lilybiri.com/scrolling-text-interaction-to-replace-text-entry-box

 

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Hi,


Thanks for the reply.

 

I don't need to score the TEB, it's just some free-text that they can enter. I understand what you mean about the Scrolling Text but the user needs to be able to edit the text that is displayed so the workflow would look like this - 

 

Slide 1 - TEB (or similar) where user enters some text

Slide 2 - TEB (or similar) where user sees Slide 1 text and can edit this text

Slide 3 - TEB (or similar) where user sees Slide 2 text and can edit this text

 

Hopefully that's clearer.

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

That is perfect for the Scrolling Text interaction. Did you read the post? The variable can be displayed and the learner can be allowed to edit the displayed text, which will lead to changing the value of the associated variable.

Your question was clear enough to me, or I wouldn't have posted my answer.

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Ok so how do I actually get the previous variable to display in the Scrolling Text box? This is the part I don't see explained.

 

I assumed i would put $$variable1$$ as the default text into the scrolling text interaction but that doesn't work. 

 

test.PNG

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

One of these two possible workflows:

  • If it doesn't need changes on the next slide (formatting, size) you can time the Scrolling text interaction for the rest of the project. On each slide the text content can be edited.
  • If you want different styles on the slides, use the same variable for all the Scrolling text interactions.

 

Maybe too simple?

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Yeah I don't think you are understanding. You said it was possible to pull a variable into a scrolling text interaction but it's not. It just isn't, unless you can explain what I'm missing? I can set a scrolling text interaction TO BE a variable but it can't pull in a variable as the default text.

 

I need the user to be able to edit the text they entered on the previous slide and each time they edit it a new variable is created holding the updated text. So in the end there will be 4 or 5 variables with text updated on each slide - 

 

Slide 1 - Variable 1 - "Hello"

Slide 2 - Variable 2 - "Hello this"

Slide 3 - Variable 3 - "Hello this is"

Slide 3 - Variable 4 - "Hello this is a test"

 

I'll maybe hold on for the JS people to turn up hopefully!

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

This is different from your original question: you did not tell that you need to KEEP all the texts in the different entry fields. If you edit the text in a TEB, the variable is changed as well, I presumed this would have been the case for the Scrolling text interaction as well.

You will need an advanced (or shared) action to be triggered On Enter for the next slides

Have 4 variables if you have 4 subsequent slides with an interaction. When clicking the next button on the first slide, where the entry is stored in v_one, use this action on Enter for the second slide

  • Assign v_two with v_one
  • Go to Next slide

The text from the first slide will now be shown in the interaction on the second slide, but can be edited and the edited value will be in v_two

Ditto for third and fourth slide.

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Ok I think this is along the right lines, by using the advanced action I can get the variable to update on the next slide but the crucial part of this is still missing. There is no way to pull in a variable into a TEB or a Scrolling Text box. You keep avoiding this part of the question. I appreciate your help so far but can you just tell me if you think there is any way of pulling the variable into the text box?

 

You say this "The text from the first slide will now be shown in the interaction on the second slide, but can be edited and the edited value will be in v_two" but how? How is the interaction showing the text? There is no option to add a variable into the interaction text box?

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Giving up, because you have some misunderstanding of variables.  When typing a text into a TEB or the Scrolling Text interaction, the associated variable gets the value equal to the typed text. You can insert that value in a normal text container (shape or caption) using the X button to insert the variable, but in this case you are working with an interaction which has automatically an associated variable. There is no need to use the X workflow in that case, it is totally superfluous.

You may know that I never post an answer which I have not checked out. I still do not understand why you need to keep all the values in separate variables, which did lead to a much simpler workflow in my first answers. I prefer the Scrolling Text interaction over the TEB in this type of use case, because the shown value of the variable is always being adapted immediately.

 

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

You're giving up because you don't understand what I'm asking. I understand variables perfectly well. I cannot make it clearer for you, I need a previously created user variable to display in a Text Entry Box or Scrolling Text Interaction as the default text. That's it. That's my question. If you can't get your head around that then fine.

 

I know I can take a previous variable and display it in a text box, smart shape, whatever. That does not achieve what I asked in my original question. This was my exact wording in my original question

 

They would like the user to enter some data into a TEB on one slide then on the next slide that data pulls through to another TEB as the default text and allows them to edit it. 

 

 

Do you see? ENTER SOME DATA ON ONE SLIDE, THEN ON THE NEXT SLIDE DATA PULLS THROUGH TO ANOTHER TEXT BOX AS THE DEFAULT TEXT TO BE EDITED.

 

It's super clear. You have misread or misunderstood the question.

 

It's the clients request to have the learning structured in this way so that they continuously build on their answer as they learn new ways to structure it. So they start off with a basic answer and continue to add to it until the final answer is something that is much richer and more valuable. 

 

I do appreciate your efforts to help but you need to be more open to feedback. You have misunderstood the question here yet you continue to make it out as thought I don't know what you're talking about. Be open to criticism and if you don't know the answer just say that. It would be more helpful to me if you had just said "i dont think thats possible." Then fair enough.

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

I have a suggestion for you.

 

First one is to make sure all TEBs are showin as referencing the same associated User Variable.

Next you will need to have the CpExtra HTML5 widget.  (Trial version is available on request from Infosemantics.)

 

In CpExtra there is a special xpref variable called: xprefPreventTEBOverwrite

 

See more information here in the CpExtra Help Files:

https://widgetking.github.io/cpextra/variables/preference.html#xprefpreventteboverwrite

 

As long as each of the Text Entry Boxes are all connected to the same Captivate User Variable, and CpExtra is loaded at runtime with xprefPreventTEBOverwrite set to True, then each of the TEBs should show whatever is currently stored in the associate variable.

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

@RodWard  OP feels compelled to have each edited value in another variable (never explained why). Moreover he is obessed by feeling that he needs to use the workflow to insert a variable in a static text for the interaction (TEB or Scrolling Text interaction. That means inserting a variable in another variable.

 

I regret the time spent here, even to create a sample projectt to double-check the workflow. Wasted time, resulting in insults.

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

quote

@RodWard  OP feels compelled to have each edited value in another variable (never explained why). Moreover he is obessed by feeling that he needs to use the workflow to insert a variable in a static text for the interaction (TEB or Scrolling Text interaction. That means inserting a variable in another variable.

 

I regret the time spent here, even to create a sample projectt to double-check the workflow. Wasted time, resulting in insults.


By @Lilybiri

 

I really don't appreciate your tone with this. You can stop replying if it's stressing you out so much. As for your comment the OP never explained why, em I think you'll find I did in my last reply to you - 

 

It's the clients request to have the learning structured in this way so that they continuously build on their answer as they learn new ways to structure it. So they start off with a basic answer and continue to add to it until the final answer is something that is much richer and more valuable. 

 

Can you actually try reading my comments before getting snarky about it?

 

You simply don't understand what or why I'm trying to do this so please just stop commenting. You've been less than helpful.

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Hi Rod,

 

Thanks for that suggestion. I haven't heard of CPExtra before so I'll look into that now. It does sound like it might help,

 

Thanks,

 

Votes

Translate

Translate

Report

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
Advisor ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

You can achieve this with a couple lines of code in the onEnter action of your slide.

Each slide where a new TEB is located will need a slightly modified code because we need to address different named text boxes and reference different variables. I will provide the code for a transition from slide 1 to slide 2 as an example and hopefully you can see how to modify it for your own needs.

 

setTimeout(function() {
TEB2=TEB1;
document.getElementById("box2_inputField").value=TEB1;
},100);

 

Basically we have three things going on here.

1. A timeout  that has two commands which execute after a tenth of a second after entering the slide.

2. We set the variable associated with the TEB on slide 2 to equal whatever was entered into the TEB on slide 1

3. We find the actual text entry box input field on slide 2 and set its visible contents to be equal to the TEB1 variable

 

Subsequent slides will just need to update the name of the variable and the name of the TEB itself.

Hope this helps. Let me know if you need any further assistance with this.

Votes

Translate

Translate

Report

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 ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Yip that's it! You smashed it!

 

Thank you! This is exactly what I was after. 

Votes

Translate

Translate

Report

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
Advisor ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

LATEST

Glad to hear this worked for you.

Votes

Translate

Translate

Report

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