I'm using Captivate 2019, I want to set a text entry box to force a user to enter their name and if they omit this, then a message box to display stating that their name must be entered before they can continue. I have set up my text entry box and trxt caption box to display the message but I've been unable to get this to work.
I have seen a guide to how to do this but I think it is old and some of the advanced actions look different in my version. I did manage some of it in adding an advanced action of creating if v_name is equal to v_null and Show NameIncorrect. The guide then goes to adding an expression and this is where I get stuck. The example shows rdcmdGoToFrame = rdinfoCurrentFrame - 1. I can't see rdcmdGoToFrame or rdinfoCurrentFrame in the drop down lists. Can anyone advise me please?
Thanks in advance
Have a look at this blog post, where I explain in detail exactly this use case:
Thanks but I'm very new to all of this! I still don't understand what I need to do, I've attached an image of how far I got, could you possibly spell out what I need to add next?
Are EntryData and Empty the names of variables that you created?
Or are you using the names you assigned and choosing literal in the advanced action window?
Did you assign the text entry box to use the EntryData variable?
Yes EntryData and Empty are the names of the variables. The advanced action does work in that if no name is entered the text caption is displayed to tell the user to enter their name. When the name is entered nothing happens when the submit buttion is clicked. Do I need to add furtheradvanced actions?
Did you add an ELSE action for when the advanced action is false?
The names of your objects are case sensitive so if yours is named Error (uppercase E) - that means error (lowercase E) would not work. The ELSE tab should be way to the bottom.
It will work with HTML5 just fine but I would not waste my time with SWF at this point.
OK I found the ELSE and entered that, I've atached an image from a guide I was following, the issue I have now seems to be where the guide shows an Expression needs to be entered, I am seening a yellow triangle with exclamation mark and not seeing the green tick as with the other actions. Any idea what I have done wrong?
You defined two variables, I start them with v_ to identify them as variables.
What you cal 'EntryData' should be the variable associated with the Text Entry Box, which is NOT validated.
What you call 'Empty' is the null variable.
Erro should be the text container with the warning message, which is initially hidden.
Will leave you to the HS expert, but don't forget that for a newbie advanced actions are much easier to understand and use, lot less debugging needed.
Here is a link to a basic blog about Text Entry Boxes:
In your blog you have set up an Expression, this looks like what I have wrong as I am seeing the yellow triangle with exclamation mark and not the green tick. What do I need to enter for the expression to work?
I've got it all working now! Thank you for your time.
Sorry, but I live in a totally different time zone and was sleeping.
When you see a yellow triangle, it means that the command on that line is missing something, is not finished: can be a parameter which has not be defined or is waiting for confirmation.
Expression is a specific command which you only find in advanced and shared actions. It has only the four basic mathematic parameters but can very useful, especially for micro-navigation as is here the case.
There is a lot to be learned about Advanced/Shared actions on my blog. But when I quit this forum at midnight yesterday, I was under the impression that you wanted to use the JS solution by Greg? Sorry for the confusion.
No problem Lilibiri, I later realised that I didn't need an Expression for what I needed to do so I left it out and it now works! I totally appreciate that there is a lot to learn about Advamced/Shared actions so I will keep looking at your blogs. I was also just trying out the JS solution as an alternative. Thank you very much for your advice.
I am astonished that you didn't need the Expression command. Do you want to allow a second attempt after the error message appeared because the TEB remained empty? Since it is a non-validated TEB that is only possible if you re-enter the slide. That was the reason I posted a link to that blog about Basics for TEBs.
I've attached an image of how I've set it up. If the name is omitted from the TEB, the error message is displayed. It then allows the user to follow the instruction and enter their name, click the Submit button and move to the next slide which is what I need! Does it seem odd that this works?
OK, see that you use the 'old' workflow, to replay the slide. with the Assign command, but you made it rather complicated. There is a system variable which stores the present slide number: cpInfoCurrentSlide. Because that is a variables starting with 1, and cpCmndGotSlide starts with 0, you should have used an Expression as well:
Expression cpCmndGotoSlide is equal to cpInfoCurrentSlide - 1
That worked fine for SWF output, but did you really test it for HTML5 output? This means that if you use a npon-responsive project you need to test it with F11, Preview HTML in Browser. You may discover that it is NOT working for HTML output, at least it didn't for several versions. It looks to me that you did use the very old post I created for 'Where is Null', but that one was only for SWF output, HTML5 output didn't exist at that moment.
I publihed to .swf, you are right though about HTML5. I tried Publishing in that format, the error message is displayed if the name is omitted but the submit button doesn't work to go to the next slide. I'll try setting it up like you suggest and then publish to HTML5. I'll let you know how I get on. Thank you.
I would not publish to SWF anymore, since the end of Flash Player by all browsers is so near....
Yes I had heard that, I'll give it a try in HTML5.
I have attached an image of how I have tried to set it up with an Assign and Expression for publishing in HTML5. When I try this the error message is displayed if the name is omitted but when the name is entered and the submit button clicked it does not move on to the next slide. Have I misunderstood how to set this up?
You completely misunderstood. For HTML5 output you need to re-enter the slide, which is not happening with this command. You need to use the mcro-navigation approach I described in the blog, not the old on e but the new one for which I offered you a link to start with.
Moreover, if this was SWF output, you only need the Expression command, the Assign makes no sense at all. Can you please download the explanatory table about system variables from this post:
OK thanks, I'll take a look at your post on system variables. I did also try the Java Script method that Stagprime provided and that worked in HTML5 format but not in .swf. So I now have one method that works in .swf and another that works in HTML5! I kind of understand what the JS code is doing and I .really don't mind using either method. I won't be publishing in .swf format fr too much longer so may have to go with the JS method if I can't fathom out how to do it with variables. Thanks for your time and patience!
Of course, that is the easiest way at this moment, because you are very new to Captivate. Do not spend time on SWF output anymore and keep with the JS solution. Did you test if the learner can re-try to put data in the TEB?
I would echo the advice to move away from SWF.
The reattempts should work fine. In my example, I have the else action as going to the next slide so there needs to be a next slide to go to, of course.
I believe that code, if written well, can be very easy to follow.
I have also said before that my ultimate goal is for people to learn and understand as well - rather than just copy paste all the time - but original motivation needs to come from somewhere. Little snippets like this can help provide not only the answers but also the motivation.