Where is Null?

Confession

Today I realized that one of my (hidden) reasons for starting this blog 5 months ago, is ... my laziness!
 
Why? Some questions appear often on the user forums, Twitter, Linkedin. Most of my postings here just give an answer to those popular questions. Now it is so easy: just point at the appropriate blog post, no need to having to repeat the same answer again and again. And the subject of this article is such a question.
 

Question 

This popped up yesterday on Twitter, quote:
"Any idea how to reference null value in CP5 advanced action? As in v_SomeVar is not equal to null? Is it a system variable?"
My answer (in less than 140 characters);
No system variable in AdobeCaptivate: vreate user variable, value empty and conditional action.

Use case: account

To explain this cryptic answer, I will show the rather common use case where a user has to type in his name (login) and password. Beware: I will not check here if the password is the correct one, only check if the user has indeed typed a name and a password, if the fields are not left empty by the user.
 
Most programming languages do have something like 'Null' if you want to check if a variable is empty, but this is not the case for the simple scripting solution, called advanced actions, in Captivate. As I answered there is no system variable provided. It is also not possible to create a condition like:
IF  v_name =
Such a condition will be marked as incomplete, because there is nothing to compare the variable v_name with. Strings (text) are not between " " as in some programming languages, so this solution is not working either:
IF  v_name = ""
This will be interpreted as if the variable needs to have the content ''" which is not the case of course.
 

Try it

Please play with this movie to catch the workflow. You will be asked to type in your name. Clicking on Submit wil result in checking if the Text Entry Box is left empty. In that case a text caption will pop up to warn you. If you have typed in a name, another text caption pops up (using your name) and the Text Entry Box for the Password will be enabled while the Name TEB is disabled. Same scenario for this password field: if it is left empty wjen submitting a Text Captino will pop up. If you typed a password (be sure to remember what you typed) you will navigate to the next slide. There you will be asked to confirm the password.

Variables

I created 4 user variables:
  • v_null  is the magical replacement of Null, be sure to put nothing in the Value on defining this variable, it has really to be empty
  • v_name  will store the entry in the TEB for the name
  • v_password   will store the entry in the TEB for the password
  • v_pass2   will store the entry in the TEB on the last slide, where the password has to be repeated.

Text Entry Boxes

None of the TEB's has the 'Validate user iinput' checked, because we do not have any correct entries, user is free to choose a name/password. The Text Entry Boxes for the password have both 'Password field' checked so that the input characters while typing are replaced by asterisks. Each TEB triggers an advanced conditional action:
  • Checkname   is triggered by the TEB for the name

  • CheckPassword    is triggered by the TEB for the password

  • PassSecond    is triggered by the second password TEB
In the Image Gallery you will find those three advanced actions. I'm prepared to offer you the file (Captivate 5), but cannot include it here. Please send me a DM on Twitter with your e-mail address or post it in the comments here and I'll send you a link. If you really want more explanation about the actions, leave a comment.

 

35 responses
HI, this is vbcon007. I understand what you are teaching in this post. My last question is how do I set up the variable to check that text in general has been entered into the TEB? Then how does the facilitator see this? Do you have steps?
In this example the variables v_name and v_password will have the entered value as content. If you attach a score to the TEB, using the Reporting accordion of the Properties Inspector, indicate that this should be included in the Total score, and set up so that interactions and score are reported, normally the LMS will show you the entry in the TEB's.
I just re-followed you on Twitter - hope you do the same :)
wow.. I think I got it
How do you add a new line or carriage return to a variable?
Amy, AFAIK you cannot insert a CR into a variable on definition. If the var is inserted in a text caption, and the caption has the space, the content of the variable will wrap automatically. In a TEB you need to activate the scrollbar, if you expect the variable to be longer than one line.
something went really wrong on my TEB. im using v_null and rdcmndgotoframe=rdinfocurrentframe-1 else go to next slide. The problem is..when the user click submit without writing on the text entry it execute the actions then when the user write something it doesnt seem to execute the else action. the slide seem to be stuck.
Bit difficult to see the problem without seeing your actions, file. Could you please post your question on one of the user forums? I'm always around.
http://forums.adobe.com/community/adobe_captivate (Adobe ID needed) or
http://captivate.adobe.com/captivate/topics
HI Lieve, can you share the Captivate 5.0 file to see the sample?
@itzelmb For several reasons (bad experiences in the past with people who just copied courses, files and didn't even reference to me) I do not want to share files. If you have questions, need more clarification, I'll be happy to answer.
Hi Lieve, I understand. I am having the same issues that Leslie Hanley described here 4 months ago. " im using v_null and rdcmndgotoframe=rdinfocurrentframe-1 else go to next slide. The problem is..when the user click submit without writing on the text entry it execute the actions then when the user write something it doesnt seem to execute the else action. the slide seem to be stuck. "
OK, figured it out. The text entry box's variable name did not match the one i used in the advanced actions. it works now.
Brilliant. I spent a few hours trying to solve a problem just like you described. Your solution of creating a new variable and not assigning it any value, and then checking against this "null" thing to see if a text field is empty was just what I couldn't figure out on my own. Thanks.
Thanks Douglas, glad that this old post is still useful for you.
Do you know if there has been any improvements in this area with the release of Captivate 8?
Not at all...still waiting for a better solution. If CP could differentiate numbers and strings, and supported concatenation, it would be much more powerful.
Hi Lieve. Can you please send me the sample file if compatible with Captivate 8.0? I have been struggling with this for some time and look at your solution as a life save.
Worth trying of course, but No. All tutorials on my blog are free, you'll not find many consultants/trainers that generous. I don't offer free files as well. Moreover I should have to recreate the file because it will not be compatible with latest version.
Thanks Lilybri! This was very helpful!
You're welcome, Addie, old post but still valid which is great!
Hi Lieve, just wanted to say thank you for this post. It was incredibly helpful!
You're welcome! Was so glad when I discovered this workaround years ago.
Hello Lieve, I'm using CP9 and I want to make it so that the learner has to respond in the text box in order for them to proceed to the next slide. I'm trying to re-create the scenario above, but where does "rdcmndgotframe" and "rdinfocurrentframe" come from and what does that part of the formula do for the advanced action? I've created v_null as a variable, and I've created v_name as a variable and assigned this to the TEB. Thank you!
This is a very old post, lot has changed. The system variables starting with rd have been replaced, in this case by cpCmndGotoFrame and cpInfoCurrentFrame. They are used for Micronavigation, maybe you should read my article about that topic?
Thank you, Lieve! I read through "Micro-Navigation in Adobe Captivate" but I'm not quite sure how to make this new functionality work so that I am able to lock down TEBs so the learner has to input some form of text before moving on in the course. Your help is greatly appreciated!
I've been looking through your blog. What a fantastic resource. Thank you for doing this.
This is really great, but I am having one error. If I click on 'Submit' before I properly enter the TEB, I am stuck on the log in slide. Even after I properly input text into the TEB after, I am stuck on that slide and cannot advance. Any ideas? If I properly type both TEB and before hitting Submit it will go on to the next slide, but I wanted to fix this since I believe some users will try to click Submit without having to input the fields first. Then if they try to correct themselves they will be stuck. I hope that made sense. Thank you!
Did you follow the steps? If there is no entry in the TEB, the conditional action will check it and launch the message to fill in the fields. That was the purpose of this article, which is still valid in the latest version of Captivate. If you want more help, it is much easier to post questions on the Adobe forums, or from the Community portal.
Yes I followed all the steps and yes the failure message does pop up. But once the failure message has popped up and I insert an entry into the TEB to correct it, it gets stuck and will not continue to the next slide. Maybe I'll start fresh and try again. I must have missed something along the way.
Forgot to ask: are you perhaps publishing for HTML? This is an old article, was only for SWF output at that moment. Recently I discovered and logged a bug (hope it will be fixed soon) where the micro-navigation I used to put the playhead back before the pausing point of the TEB is not functional in HTML output. The only way to have it working is to re-enter the slide with the Replay scenario two which I described in a recent blog post.
5 visitors upvoted this post.