Adobe Captivate Widget: Using Variables In The Default Text of a Text Entry Box (TEB)

del.icio.us Tags: ,

This is an upgrade to the previously posted widget TEB Default Text As Variable.  This upgraded version will work with Adobe Captivate 4 and 5 and is built on the WidgetFactory Platform.  Unlike the previous version, this one supports multiple variables inside the default text field.

The Cp author would use variables surrounded by dollar signs inside the Default Text field for the TEB.

Default Text Image

At runtime, those variables would display their respective values like so:

At Runtime Image

Requirements:

The Captivate 4 or 5 project must be published for AS3 and FP10+.

Download Widget

Tags:

  • David Bennett

    Hi Jim,

    Just stumbled on your site and it looks like your doing great work!

    A question about this widget (and widgets in general I s'pose): where does Cp collect the vars from? Are they sendVars?

    I will of course be checking tha widgetfactory that you link to but thought mebbe you could just shed some light on the basic mechanics of it.. ;)

    regards

    David

  • Jim Leichliter

    @David Bennett: Tristan Ward, the creator of Widget Factory, just did a great free webinar on how to use Widget Factory. You can find it here:
    http://blogs.adobe.com/captivate/2010/09/advanced-captivate-5-users-learn-to-create-widgets.html

    He's documented the API extensively and answers your questions about variables:
    http://www.infosemantics.com.au/widgetfactory/doco/index.html

  • David Bennett

    That's great Jim, thanks.

  • Distance learning

    Great post! I use Adobe Captivate as one of my E-Learning tool and your blog is such a big help for me. Thanks for sharing. I'm looking forward to read more of your blog.

  • James Anderson

    Hi Jim,
    this is a great widget and almost lets me do something that I've been trying to work out for ages.

    What I want to do is to create a way for users to take notes. I've used your widget to pass a users $$notes$$ into the default text of the next text entry box that then updates $$notes$$ – very cool. But the text entry box isn't very good for collecting lots of text.

    There is a text area widget that ships with Captivate, but it wouldn't let me use your widget to enter variables as it's default text. Can you see anyway around this.

    If I could just get a text entry field that would enter user friendly formatted bodies of text, we'd be home!

    Thanks for your great work!!

    James

  • Jim Leichliter

    @James Anderson: That's a very cool idea! Let me see what I can do. When do you need this by?

  • Jørgen Bjerke

    Hi Jim. Very cool widget. It solved almost everything I have been searching for for weeks! But one question:

    I use Cp 5. In my course I need a TEB (Text entry box) as a notepad where the learner can type a sentence. Then, in another slide, he needs to get that TEB back so he can modify his sentence, and in another slide, modify it again etc. as he learns more and more. If he steps back to the first slide, the TEB should show him his last modified sentence.

    I almost solved this by putting $$sentence$$ in every TEB. But the problem is: When the learner opens the course for the first time, and jumps to a slide with this TEB, the slide loads for several seconds, and then shows the TEB with "$$sentence$$". Not so nice :( Then he change this to let's say "Hello". After that every slide with the TEB shows "Hello" (Yey), even if he closes the course and reopens it (I use SCORM and Moodle LMS), and now all slides loads instantly :)

    So I need to solve this "loads forever"-thing and the not so nice "$$sentence$$" in the TEB. I think I need to set the variable $$sentence$$ to something like "Type your sentence here" as a default value in the beginning of the course. I tried to add a welcome slide as slide 1 and add a hidden (behind an image) TEB with "Type your…" as the default text, and set this TEB to the variable "sentence". But that didn't work. It seems that you have to manually type something to set the variabel, because if I do that everything else works great.

    Do you have a solution for this? Thanks a lot in advance!

    Jørgen Bjerke

  • Jim Leichliter

    @Jorgen Bjerke: Try staggering the TEB and Widget on the timeline. Make sure the Widget shows first on the timeline, even if it's a 0.1 second difference. This should give the widget a chance to initialize the TEB before the TEB is displayed.

  • Jørgen Bjerke

    Thanks for a very quick answere. But I'm sorry. It didn't help. The first slide still loads for 10-15 seconds, and the TEB still shows $$sentence$$.

    Isn't it a way to preload the variable with something? I tried the menu Project – Variables… and put "Type your sentence here" as the value for $$sentence$$, but that didn't help either.

    JB

    • http://twitter.com/andrewminton Andrew Minton

      Hey Jorgen, what was the solution to the 10-15 seconds delay here? we’re experiencing a similar problem trying to populate $$vars$$ from URL to Captivate 4…

      Any help of experience here would be greatly appreciated. 

  • Jim Leichliter

    @Jorgen Bjerke: Can you send the first couple of slides of your project and I can take a look? JimLeichliter (AT) Gmail dot com. You also may want to try and display the widget for the entire length of the slide. Is your project published for Flash Player 10+?

  • Jørgen Bjerke

    Mail sent. Yes it is published for Flash 10+, and the widget is displayed for the entire slide. Thanks a lot for helping me :)

  • rob gagnon

    This seems exactly what I need, bit it doesn't work for me… I am using Captivate 5, and hence AS3, and setting for Flash 10, and using a Flash 10.1. Tried all sorts of permutations, certainly my variable is spelled correctly, as $$studentname$$. Tried delaying TEB by as much as 0.5 secs. Any suggestions? Thanks – Rob

  • Jim Leichliter

    @Rob Gagnon: After working with Jorgen Bjerke, we discovered that the MAC version of a text entry box is different from the windows version. In fact, if you place them side-by-side, you'll notice that the MAC version has a scrollbar which indicates that it may be neutered version of a Text Area control. Rob, any chance you're working on a MAC? If so, I have a version of the Text Area widget that does the same thing and it worked out very well for Jorgen.

  • Peter Ivison

    Hi Jim,

    I’ve just started using captivate 5.5 to develop software simulations, and this widget looks as though it is exactly what I need to accurately simulate the free text entry fields.

    So far the data entry functionality is working well, but I’m having some trouble getting the tab order to work correctly.

    I want the users to enter data into four fields on a single page, and have the option of tabbing between the fields. I have set the tab order by adjusting the order of the text entry boxes on the timeline, but the focus always defaults to the last text entry box in the tab order, rather than the first as would be expected.

    Any hints on how to fix this?

    Thanks,

    Peter

    • Anonymous

      @Peter :  I’ve had the same problem too.  I’ve also noticed that the tab order can follow the same order you placed the TEBs on the canvas.  Try doing that.  If that doesn’t work, you can try Chris Dorna’s Tab order widget found here:
      http://www.dorna.nl/?p=509

      • Peter Ivison

        Thanks for the quick response Jim – Chris Dorna’s tab order widget has done the trick.

        Cheers,
        Peter

  • Trihan

    Hi Jim

    I’ve tried this widget and am having the same issue as Jorgen and Rob were, but I’m using Windows. Any ideas?

    • Trihan

      Just a quick amendment, it seems that this only happens if I set the default text to the variable that the TEB is itself associated with. As this doesn’t work, can you think of any other way to have TEBs repopulate with the entered text when resuming the course?

      • Anonymous

        @Trihan:  It sounds like a possible timing issue of getting and setting the same variable at the same time.  The widget is trying to get the variable $$var$$ to display it in the TEB, and the suspend data is trying to set $$var$$ at the same time… hence the delay One possible work around would be to include an advanced action near the end of your course to make the vars associated with your TEBs equal to their display vars.  This way, when the Learner resumes the course, the display vars will properly show what they’ve entered from the previous session. Jim Leichliter

  • Maria Neary

    Is there a way to modify the existing TEB on Cp 5.5 so that text entry is auto-scrolled in the box without having the scroll bar showing?

    • JimLeichliter

      @983a11a99f44f7e0fc9fa1043a0dc431:disqus:  The only way to get rid of the scroll bars is to size the TEB to fit the text. Auto-scrolling would be a great feature you may want to request.
      http://captivate.adobe.com/captivate#idea