Highlighted

Set up a text entry box to not accept a null value

Community Beginner ,
Oct 27, 2019

Copy link to clipboard

Copied

Hi

 

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

Guy

Most Valuable Participant
Correct answer by Lilybiri | Most Valuable Participant

Have a look at this blog post, where I explain in detail exactly this use case:

http://blog.lilybiri.com/where-is-null-in-cp2017

 

No Javascript needed, just some simple advanced actions. All is based on comparing the variable associated with the TEB to an empty variable which I indicate as v_nullo. I refurbished an olde blog of 8 years ago for HTML output. That old post was still very well visited, hence....

Views

149

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Set up a text entry box to not accept a null value

Community Beginner ,
Oct 27, 2019

Copy link to clipboard

Copied

Hi

 

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

Guy

Most Valuable Participant
Correct answer by Lilybiri | Most Valuable Participant

Have a look at this blog post, where I explain in detail exactly this use case:

http://blog.lilybiri.com/where-is-null-in-cp2017

 

No Javascript needed, just some simple advanced actions. All is based on comparing the variable associated with the TEB to an empty variable which I indicate as v_nullo. I refurbished an olde blog of 8 years ago for HTML output. That old post was still very well visited, hence....

Views

150

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 27, 2019 0
Most Valuable Participant ,
Oct 27, 2019

Copy link to clipboard

Copied

Have a look at this blog post, where I explain in detail exactly this use case:

http://blog.lilybiri.com/where-is-null-in-cp2017

 

No Javascript needed, just some simple advanced actions. All is based on comparing the variable associated with the TEB to an empty variable which I indicate as v_nullo. I refurbished an olde blog of 8 years ago for HTML output. That old post was still very well visited, hence....

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Community Beginner ,
Oct 27, 2019

Copy link to clipboard

Copied

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?Captivate.JPG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Advocate ,
Oct 27, 2019

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Most Valuable Participant ,
Oct 27, 2019

Copy link to clipboard

Copied

Yoi seem to prefer JavaScript, and didn't really follow my blog post. It is important to label everything in a correct way, because Captivate doesn't support having the same label used for two totally different items.

 

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:

http://blog.lilybiri.com/text-entry-boxes-back-to-basics

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Community Beginner ,
Oct 27, 2019

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Advocate ,
Oct 27, 2019

Copy link to clipboard

Copied

Did you add an ELSE action for when the advanced action is false?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Community Beginner ,
Oct 27, 2019

Copy link to clipboard

Copied

No I didn't enter an ESLE, hadn't spotted that, I'll try that and let you know. I had a go with the JavaScript method and did get an error as you suggested. I rentered the " marks, which got rid of the eror but it didn't trigger the error message if the name was omitted. Should this work with .swf and HTML5?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Advocate ,
Oct 27, 2019

Copy link to clipboard

Copied

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.

 

else.jpg

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Community Beginner ,
Oct 27, 2019

Copy link to clipboard

Copied

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?Cap Error.JPG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Community Beginner ,
Oct 27, 2019

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Community Beginner ,
Oct 27, 2019

Copy link to clipboard

Copied

I've got it all working now! Thank you for your time.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Most Valuable Participant ,
Oct 28, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Community Beginner ,
Oct 28, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Most Valuable Participant ,
Oct 28, 2019

Copy link to clipboard

Copied

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. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Community Beginner ,
Oct 28, 2019

Copy link to clipboard

Copied

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?

 

Captivate2.JPG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Most Valuable Participant ,
Oct 28, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Community Beginner ,
Oct 28, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Most Valuable Participant ,
Oct 28, 2019

Copy link to clipboard

Copied

I would not publish to SWF anymore, since the end of Flash Player by all browsers is so near....

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Community Beginner ,
Oct 28, 2019

Copy link to clipboard

Copied

Yes I had heard that, I'll give it a try in HTML5.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Community Beginner ,
Oct 28, 2019

Copy link to clipboard

Copied

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?

 

Captivate html5.JPG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Most Valuable Participant ,
Oct 28, 2019

Copy link to clipboard

Copied

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:

http://blog.lilybiri.com/discover-slash-use-captivates-system-variables-part-1

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 0
Community Beginner ,
Oct 29, 2019

Copy link to clipboard

Copied

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! 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2019 0
Most Valuable Participant ,
Oct 29, 2019

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2019 0
Advocate ,
Oct 29, 2019

Copy link to clipboard

Copied

Glad to hear you got it to work. If you are interested in learning more about how to use JavaScript in Captivate - please check out this post.

Getting Started With JavaScript and Adobe Captivate 

 

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.

The JavaScript doesn't care about the TEB - it behaves based upon the value of the variable.

Sometimes the best way to learn is through exposure and having your feet to the fire so to speak. When I started using JavaScript instead of advanced actions it was because advanced actions were not able to solve my problem. JavaScript not only solved the problem but I realized how much simpler it could be.

 

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2019 0
mannguy LATEST
Community Beginner ,
Oct 29, 2019

Copy link to clipboard

Copied

Thank you Stagprime, I'll take a look and see if I can learn a bit about JavaCode. The reason I'm still publishing to SWF is that I upload files to an intranet which is quie old and doesn't have compatibilty with HTML5. Moving over to a new system shortly so I'll then publish in HTML5.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2019 0
Advocate ,
Oct 27, 2019

Copy link to clipboard

Copied

If you're interested in another approach to this - I offer a JavaScript option.

 

1. Make a text entry box and delete the submit button that comes with it.

2. Make a variable (in my example - I call it  yourName)

3. Make sure that the text entry box is associated with the variable that you create.

4. Make your own smart shape to act as a button by clicking the 'Use as Button' check box

5. For the button onSuccess action - choose 'Execute JavaScript'

6. Place the following code in the Script_Window

7. In this example I have a box named 'error' that is hidden by default and have it show if the field is left blank.

 

if (yourName=="") {
cp.show("error");
}

else {
cp.goToNextSlide();
}

 

In my example - you would just need to replace the  yourName  variable with your own.

If you have any questions about this I would be happy to elaborate.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Community Beginner ,
Oct 27, 2019

Copy link to clipboard

Copied

Thank you Stagprime, I've never attempted anything with Javascript but I 'll give your suggestion a go and let you know how I get on. Thanks again.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Advocate ,
Oct 27, 2019

Copy link to clipboard

Copied

If you copy this - it may fail until you go back and delete the quotation marks and actually type them with the keyboard.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Most Valuable Participant ,
Oct 27, 2019

Copy link to clipboard

Copied

The blog post clearly has a conditional action with ELSE included. 

 

CheckTEB.png

This must be very confusing for a newbie,  because in this thread two proposed solutions are now mixed up.

 

I understood that you wanted to use tje JS solution... My approach is different, as a diehard teacher I prefer to teach how to fish, in stead of offering a fish (copy/paste code without realy understanding it). It is up to you which approach you prefer, but both will need time...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2019 0
Adobe Community Professional ,
Oct 28, 2019

Copy link to clipboard

Copied

I am personally VERY grateful for Stagprime offering his JavaScript solutions when able.  

 

I like fish and chips.  Personally, I don't care HOW the fish was caught as long as it tastes good in batter.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 28, 2019 2
Advocate ,
Oct 29, 2019

Copy link to clipboard

Copied

Thanks Rod,

As I stated above - I also prefer that people learn and understand but how else do we motivate learning if not by exposing the learner to that which is possible?

As they say -  "You don't know what you don't know."

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2019 0
Community Beginner ,
Oct 29, 2019

Copy link to clipboard

Copied

"I like fish and chips.  Personally, I don't care HOW the fish was caught as long as it tastes good in batter". That's funny lol.  Whilst I do just need a solution and I don't really mind which way I get there, I do really appreciate all of the advice and solutions to my issue that both Stagprime and Liliybiri have offered.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2019 0