Skip to main content
Known Participant
February 7, 2011
Question

About dropbox and combobox widgets and variables

  • February 7, 2011
  • 2 replies
  • 2237 views

This is a two-part problem.

First, I wanted to use a combo box (or drop box) widget to insert a field that can be populated by choosing one of six options (A through F). The variable that gets populated is called 'a'. On the slide, there is the drop (or combo) box and a button that executes an advanced action. In the advanced action, It goes:

IF variable 'a' is equal to 'A' go to slide x.

ELSE go to slide y.

No matter what option is chosen on the combo (or drop) box, nothing gets assigned into the variable. I tried this with both widgets. I finally ended up using a textbox and asking the user to type the correct option into the text box.

Which leads me to the secont part of the problem. The textbox is associated to the variable 'a'. The correct answer is 'A'. The advanced action is the same as above. However, if I want to make the correct answer lower-case 'a', the advanced action ALWAYS evaluates as false and executes the 'ELSE' action, even if the user enters lower-case 'a' into the field. Regardless of what is entered as the answer in this text field, I simply cannot get a correct answer. Meanwhile, if the advanced action is changed to accept the upper-case 'A' as the correct answer, it works.

What am I doing wrong here? What do I need to do to make use of the combo box (or drop-box) widgets in the first place? Anyone with more experience?

This topic has been closed for replies.

2 replies

PVasicAuthor
Known Participant
February 9, 2011

I played a bit more with those text boxes, in order to find out why my advanced action kept failing to correctly evaluate and execute. The textbox was associated with a variable called a. The script said:

If a [the variable]  IS EQUAL TO a [a string], THEN jump to slide 1

ELSE jump to slide 2

Typing 'a' into the text box and executing the action should jump to slide 1, but it didn't.

I then renamed that variable 'a':

If Answer_A IS EQUAL TO a [a string], THEN jump to slide 1

ELSE jump to slide 2

After renaming variable from a to Answer_A, the script suddenly worked correctly. Apparently, Captivate can't quite tell the difference between variable names and strings. It probably tried to find out if variable a was equal to whatever was in that variable a, rather than if it was equal to the string 'a'. This is unlike pretty much any scripting language I've worked with, although my experience may not be that extensive. I couldn't find any reference to it in the documentation, nor could I find it mentioned on this (or other) forums. Hopefully, my little discovery might help others in the future.

I suppose the general advice (for all scripting languages) is to make variable names unique (in a broader sense), easily identifiable and unambiguous. Mine failed on at least two of those these points.

Lilybiri
Legend
February 9, 2011

Hello,

I should have pointed you to my blog, to avoid you some errors. Indeed this is not like the classical scripting languages and there is not the formal distinction between a string and another content. However the 'labeling' issue is the same as in every other scripting language. By writing articles and blogging I have tried somehow to fill in the lack of documentation about the advanced actions. This feature, that appeared in CP4, really changed the way I created Captivate files, because suddenly I could have a lot more of control. But it is not a 'normal' scripting language, agreed on that.

Lilybiri

Lilybiri
Legend
February 8, 2011

Hello,

I am preparing a blog post on the use of the widgets that come with Captivate, but it is not ready yet

This explanation is for Captivate 5, you did not tell which version you are using.

First of all advice from someone who is playing a lot with variables and advanced actions: please make the variable names a little bit more identifiable, only one letter seems a bit dangerous and could perhaps trigger something else? I always start user variables with a v_ to have them stand out in the list with variables from the system variables that start with cp or rd.

To use the widgets: you have to create the variables (Project, variables) you want to associate with the widget. It will not be automatically created when you type in the variable in the Widget properties! This should be my workflow (and I have created that kind of projects):

  • create variables v_drop and v_combo using Project, variables
  • insert widget dropdown, configure it with the list items and associate variable v_drop
  • insert widget combobox,  configure it with the list items  and associate variable v_combo
  • create the advanced action and have it triggered (perhaps by a button or by exiting the slide?)

Lilybiri

PVasicAuthor
Known Participant
February 9, 2011

Thanks for the response. it's Captivate 5 (sorry for forgetting).

I went ahead and renamed my variables to something more meaningful. That didn't quite resolve the problem. I went ahead with further investigation. I put five comboboxes, each with six different values and each populating their own variables. To see what's actually being entered into those variables, I put a simple text box on the side and populated it with variable values. My advanced action looked at those variables and and executed one of the two specific actions, depending on what the variables contained ("IF [variables] EQUAL TO [a set of data], then do this; ELSE do that"). However, no matter what they contained, it continued to execute the 'Fail' action, rather than 'Correct'. After a while, I noticed in that textbox that showed variable content, that there was a small space before the text. The space did NOT appear if I chose the first option on the list. This led me to see if the combobox would work if I listed options without any spaces. My original entry was: First, Second, Third, Fourth, Fifth. I changed the entry to: First,Second,Third,Fourth,Fifth. This finally solved my problem!

It seems that the widgets that come with Captivate don't behave consistently. Checkbox widget works properly when options are entered with spaces after commas. Combobox doesn't seem to. I haven't tested dropbox yet (I'm in a rush to deliver), but my guess is it won't allow spaces either.

One way to resolve this would have probably been to modify the action to say: IF [variable] CONTAINS [literal]..., instead of: IF [variable] IS EQUAL TO [literal]...

So, this problem has now been resolved. However, I now have a weird problem that I can't figure out, and it looks like a Captivate 5 bug. I have some 15 advanced actions. For some reason, I can no longer select one of them (no. 7 or so). All others I can select and edit, but this particular one I can't recall at all. The action no longer works correctly, so I re-created it, called it something else, and am now calling this new one. The original one can't be edited or deleted, and I'm just a bit concerned what's happened with that script.

Has anyone encountered this situation before?