Update
An upgraded version of this blog can be found under this link.
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.