• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
Oct 27, 2019 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

Views

1.1K

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
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 27, 2019 Oct 27, 2019

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....

Votes

Translate

Translate
Community Beginner ,
Oct 29, 2019 Oct 29, 2019

Copy link to clipboard

Copied

LATEST

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.

Votes

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
community guidelines
Advisor ,
Oct 27, 2019 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.

Votes

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
community guidelines
Community Beginner ,
Oct 27, 2019 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.

Votes

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
community guidelines
Advisor ,
Oct 27, 2019 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.

Votes

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
community guidelines
Community Expert ,
Oct 27, 2019 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...

Votes

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
community guidelines
Community Expert ,
Oct 28, 2019 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.

Votes

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
community guidelines
Advisor ,
Oct 29, 2019 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."

Votes

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
community guidelines
Community Beginner ,
Oct 29, 2019 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.

Votes

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
community guidelines
Resources
Help resources