Custom Short Answer Question


This is not the first time I publish about creating a Custom Short Answer Question. The default type in Captivate is pretty limited:  the user should enter exactly the same answer as the defined correct answer which is almost impossible with this type of question. The normal validation for such a question is to check if some keywords are present, and eventually if some other keywords have not been used. My previous posts were created with Captivate 5 for publish to SWF only:

Widgets were meant for SWF-output only, including the widget by Jim (this one, he has some widgets that are also compatible with HTML5). Since Captivate 7 the TextArea widget got a companion, the 'Scrolling Text Interaction'. Don't be confused by the name, it is essentially the same widget, but compatible with HMTL5 output. 

This week I accepted another challenge from a Captivate user on the forum, concerning the use of TextArea (or Scrolling Text) with a more complicated condition than the one I described in the previous blog posts: How to verify that a variable "does not contain" a value? As you probably know, the operators in the IF part of a conditional action are bit limited: there is an operator 'contains' but no negative counterpart. My first reaction was to propose the use of JS, but my intuition told me I should also try with advanced actions. This post will explain how I solved that problem, and I was very happy when the King of Javascript in Captivate, Jim Leichliter posted his alternative with JS in the same thread, scroll down to find the script.

In this post I will explain the conditional advanced action, and also point to another well-hidden gem, only in Captivate 8: the Captivate team has now embedded the variable control in the Scrolling Text Interaction! Don't tell that they are not listening to users :) What was only possible with the extended TextArea widget by Jim in previous versions, can be done with the supplied Scrolling Text Interaction.


The description of the problem: " We are basically validating the content in the widget and showing appropriate feedback. Since the user can enter anything in the widget, we are only tracking the keywords. To be precise, we are trying to create an Advanced Action like this, where the text entry should contain the words Organizational, Behavioral, and Managerial but not the words Transformation and Non-Compliance. If the entry contains any of the "illegal" words, then incorrect feedback caption should appear."
Translated: when the answer is submitted, the conditional action should show a Positive feedback when:
  • the three first words are included in the text
  • the last two words are not included in the text
If those conditions are not all fulfilled, the Negative feedback should be made visible.
Because of the missing operator 'does not contain' this cannot be done with one decision, one IF combination using AND, which explains why the user was stuck.

Solution 'Divide et Impera' 

After a long career as professor, this has become one of my mottoes: make it simple by splitting up the problem:
  1. Check first if all the conditions are fulfilled and store that result in a Boolean variable. There are a lot of Booleans in Captivate: variables that can have only two values, No/Yes, 0/1, False/True. I will mostly choose for the 0/1 combi. I created a user variable v_TA_OK with a default value of 0 (meaning all conditions are not yet OK)

  2. Show the appropriate feedback based on the value of that Boolean.
This was possible because of the typical way Advanced actions are executed in Captivate: 
  • all statements are executed in sequence and
  • all decisions are executed in sequence
  • the action is not stopped when a positive condition is met

This has led to a conditional advanced action with three decisions.


Watch this movie, created with Captivate 8, customized theme 'Flat', using custom shape buttons (one is a freeform shape) with three states and the new Scrolling Text Interaction.

Advanced actions - variables


To make the question more universal, I didn't use literals for the words, but stored them into variables. These variables were created:
  1. v_one, v_two, v_three to store the words (can also be more words in one variable, but they'll have to appear in that sequence) that have to be included in the answer

  2. v_notOne and v_notTwo for the words that are forbidden in the answer 

  3. v_Answer to be associated with the TextArea or Scrolling Text that will store the value typed in the answer

  4. v_TA_OK: the Boolean variable explained above; default value = 0, will only be set to 1 if all conditions result in correct.

  5. v_null: an empty variable that is needed to create conditions for the other advanced actions (as the ones that check if all word fields have been filled); I will not explain those actions here; more info: Where is Null?

Conditional action Check_Short

This action is triggered by the Submit button on the Short Answer slide. This was the answer to the problem presented at the beginning. I will not explain the other advanced actions like the one triggered by the Reset button or the different actions On Enter for slides to reset the situation to normal. The action has 3 decisions:


This decision checks if all the imposed words are present in the Short Answer, using the operator 'contains', with AND combination. If that is the case, the Boolean v_TA_OK will be set to 1.


The not-allowed words are checked with this decision, using again the operator 'contains' but this time in an OR combination, because even if only one of those words is present, the negative feedback has to appear. If any of the words appears, the Boolean v_TA_OK is reset to 0. It is very important that this check only occurs after the first decision! After this second decision (in this case) all conditions have been evaluated and the Boolean variable v_TA_OK has its final value, will be used in the last decision 


Only this last decision has also an ELSE part, as you can see in the total view of this conditional action:

As I explained in the last slide of the movie, because of the stack order, where an Interaction always is on top even though it is not on top in the Timeline, I had to hide the Interaction to be able to show the Feedback groups, because they were in the same location. Here is the Timeline of this Short Answer slide:

You see that the Interaction (indication is Widget on timeline) is not on top. The Next button is not on this slide, but on the first slide and timed for the rest of the project. That shape button is hidden/shown when necessary.


Variables are case sensitive, and contrary to validation of a Text Entry Box it is not possible to get rid of that case sensitivity for variables associated with this interaction. If necessary you'll have to create more decisions.
I wanted to emphasize the importance of sequence by this blog post, and the fact that Captivate will always evaluate all conditions/decisions. This is not always the case in normal programming languages. Trying to explain:
  • The first decision is positive, variable v_TA_OK will be set to 1, but there will not be ending of the condition
  • If the first decision is negative, variable v_TA_OK will remain at 0, no need to include an ELSE part.  This means that the variable can never be set to 1 anymore, but the second decision will nevertheless be checked by CP.
  • If both negative words are not included, nothing happens with the second decision, v_TA_OK will keep its value 1 or 0 depending on the result of the first decision, because there is no ELSE part.
  • If one of both negative words are included, the second decision will reset v_TA_OK to 0, whatever its value was at the end of the first decision
The new possibility in Captivate 8 to change the value of the variable associated with the Scrolling Text Interaction and have this displayed in the interaction is important if you remain on the same slide. Contrary to the extended version of Jim's TextArea widget, the rule that variables for each interaction are cleared when you leave the slide is also applying to the Scrolling Text. If you want to keep value of the variable you have to transfer it to another variable.

Blog after Posterous? - ClickClick


As you can see, I'm slowly moving my posts out of Posterous to a new 'haven'. Posthaven did a great job importing the blogs with not too much work left to me. It is still in beta, so not everything is styled as I want, and tags cannot be added yet. But the articles at least are safe now, will not disappear in the cloud with Posterous' death. In the future, articles will be accessible from my site, once I can manage to set it up to my wish. Due to the many reactions of Captivate users, I wanted first of all to have a solution for the blog articles. And I try to get them all available ASAP.


Since a while I get a lot of worried messages by all channels: on Adobe forums, by Linkedin, comment on this blog, mail... And they all ask the same question: what will happen to your blog when Posterous is closing down? I do find it a bit strange, that such a crisis situation leads to more contact with readers then normally. This blog seems to be useful to a quite a bunch of users. When I started, about 2,5 years ago, never imagined those articles would find their way to users all over the world. And they are useful to me as well: I spare a lot of time, just pointing to a post instead of having to repeat the same answers again and again on the user forums.

Must confess that I hesitate to search for another host. I really want to keep all rights on the content (which is not the case for a lot of blogging hosts), even though some rare readers feel they are entitled to 'take over' my ideas and propagate them as their own, without any reference. 'Since it is distributed for free, it is public, no need to point to the original author in that case' must be their way of thinking. Not very ethical, but that is only my personal opinion. 

For the moment, I do not have a final solution. I already concluded that I need to look for a non-free host in the future. Keep an eye on this blog, if I take a decision about another host, will post the link here.

If you are just plunging into advanced actions, keep on reading. I describe a rather simple use case, suited for novices in advanced actions. The only problem could be the expression 'Mimicked standard action' in the conditonal action Bt_Click. For more info about that, read this article.


I used this name for a small cptx-file, built as an example for yet another use case.:

'I am trying to use a button to toggle between 3 images. I created a variable, initially set to 0. The button triggers a conditional advanced action, where I check that variable, change it and show the next image. But it always shows the first image'

Screening the conditional action I detected that the user was trapped by the fact that in a conditional action, all decisions are always evaluated in sequence. Captivate will never stop evaluating when a correct condition has been reached, but goes on with the rest of the decisions and statements. 

Learning from mistakes is very efficient, here is a description of the original conditional action; the first image Image1 is originally visible:


  • IF var is equal to 0
  • Assign var with 1
  • Show Image2
  • Hide Image1


  • IF var is equal to 1
  • Assign var with 2
  • Show Image3
  • Hide Image2


  • IF var is equal to 2
  • Assign var with 0
  • Show Image1
  • Hide Image3

If you evaluate all decisions, you will indeed end up with always having Image1 to show up: first decision results in true, but variable is changed to 1. That means that the second decision is also true, and the variable is changed again. Ultimately the last decision will also be true because of that change, so Image 1 is shown again. 

Example movie

In this one slide movie I have a version of my answer to this use case. Here you will be toggling four images, and to make it a bit playful, when you have viewed all the photos, you can play a little game pressing the Guess-button.

If you want to see the entire movie, you'll have to download it from this link: ClickClickClick. Posterous is not supporting an interactive PDF. In the SWF embedded here, you'll not see the Hangman widget, not be able to play. The Guess button will appear, but is not able to show the interaction, sorry about that. Download the interactive pdf if you are curious about the Hangman interaction.

Slide objects - variable

On this unique slide you'll see from bottom to top on the Timeline:

  1. A group with 4 photos, labeled GrFoto; will be set to invisible on entering the slide
  2. The button BtClick that will let you toggle the images, visible and will trigger the conditional advanced action Bt_Click (it is possible to have the same name, if you define the button name before the name of the action)
  3. The button BtGuess, will be hidden on entering the slide. This button will trigger the standard advanced action Bt_Guess
  4. An instance of the Hangman interaction, initially invisible.

Only one variable was needed, v_click, with a default value of 0.

Advanced actions - events


This is a standard advanced action - triggered by the On Enter event. It will hide the group GrFoto, the button BtGuess and the interaction.


This conditional advanced action - triggered On Success by the button BtClick - has 5 decisions:

  1. Always: a mimicked standard action to increment the variable v_click and to hide the group with photos. I preferred to hide the group with this first decision to save time. It is only necessary to hide the previous shown image, but if you want to do that with an advanced action you need more statements. Because all statements are always executed, I can hide the group (same statement for each click) and afterwards show the appropriate image, depending on the click number. 
  2. Click1: checks if the variable is set to 1 (which will happen due to decision Always after the first click), and shows the first photo.
  3. Click2: similar to Click1, checks if v_click is set to 2 (after second click) and shows second photo in that case.
  4. Click3: similar to Click1, checks if v_click is set to 3 (after third click) and shows third photo in that case.
  5. Click4: has more statements than the other 3 conditions. It checks if v_click is set to 4, shows the fourth image. But because all photos now have been viewed, the button Bt_Guess is shown and v_click is reset to its initial value 0. The last statement allows the user to toggle the photos again if wanted. But the button Bt_Guess will remain visible all the time from now on.


Rather simple standard advanced action - triggered On Success by the button BtGuess. It will hide the photos GrFoto, and show the interaction that was hidden. Because the interaction is on top of the buttons, it is not necessary to hide those buttons, although if you are a perfectionist, you could hide them of course.

Learned something?

If you take time to compare the original conditional action with my proposal, you'll see how important the sequence of the decisions is, and the fact that CP never stops with evaluation when a correct condition is met. I did increment the variable with a mimicked standard action, not within the real conditional decisions. This means that the variable will not change when CP is executing all the statements. 

Some timesaver tips are concealed in the actions as well: grouping of the fotos will allow to show/hide them with one statement (see EnterSlide, Always in Bt_Click and Bt_Guess). 

Using the Expression statement to increment v_click (Always in Bt_Click) is more efficient, compared with conditions + Assign combinations.

As usual, please feel free to comment. This means a lot to me, will help me to decide about accepting the transfer work to another host.