Skip to main content
Inspiring
February 9, 2022
Question

Make a text box mandatory

  • February 9, 2022
  • 1 reply
  • 1209 views

Hi,

 

Looking for some advice on making a text entry box mandatory.

On first page of project, I have asked the user to add a name and Surname (seperate fields) .... these are to be used as variables later in the project so important I get this info.

However, the user can currently press Start and proceed to the next screen, this will cause other issues later on down the line so its imprtant I get something in the first name / surname fields

is there a way to make this mandatory? if so... how?

 

Cheers.

    This topic has been closed for replies.

    1 reply

    Lilybiri
    Legend
    February 9, 2022

    I suspect you talk about Text Entry Boxes. You find a possible workflow in this blog post:

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

     Don't be confused by the mentioning of 'CP2017', it is also valid for all versions under 'CP2019'

     

    Inspiring
    February 9, 2022

    Hi Lilybiri,

     

    Many thanks for the response.... this seems very complicated for something which i imagine would be very common in e-learning material - getting the user to add a name?

    Is there an easier option to get users to add details? is Text Entry Box not the best solution for this? 

     

    Many thanks

    RodWard
    Community Expert
    Community Expert
    February 9, 2022

    Sometimes thing that seem like they should be easy to pull off turn out to be more complex than we think.  This is one of those cases.

     

    The Text Entry Box object (TEB for short) is really Captivate's default way to allow the user to enter text of any kind.  However, in your case you don't really know what the 'correct answer' will be, because it needs to be different for each user.

     

    There is no simple option you can select in Captivate that will force the user to enter text in a TEB before they can continue. 

     

    So to pull off your design requirement, once the learner reaches this initial slide whether they should enter their name, you will need to disable all other possible ways to navigate away from that slide until they enter the required text in the TEB.  Disabling navigation means things like hiding the Playbar (if you are using one) and locking the Table of Contents (if applicable).

     

    But that's not all.  You also need to configure the interaction so that at least some text characters are required to be entered in the TEB, otherwise the learner could just hit the TEB Submit button and move on even without entering text.   The default validation options for TEBs do not prevent submitting an empty string.

     

    So the link that Lilybiri provided you goes into detail about how to use Captivate's Variables and Advanced Actions to check the value submitted to the TEB's associated variable to make sure that it contains at least some text characters.  Yes, it might not be as simple as you would like, but it works.

     

    Your only other option is to resort to using JavaScript, which is even less likely to be easy for you.