Skip to main content
Known Participant
June 9, 2015
Question

Captivate text entry fields

  • June 9, 2015
  • 2 replies
  • 237 views

Hi,

Is there any way in Captivate to make a text entry field blank and reset it automatically without clicking a submit or any other type of button?

For example, if we have a blank text field in a captivate simulation where the user is required to enter just the number 2 in order to go to the

next screen, if they type in any other number (which is wrong), then the filed automatically goes blank and they get an error message, reminding

them to just enter the number 2!

Is this possible? Maybe with a widget?

Thanks

    This topic has been closed for replies.

    2 replies

    TLCMediaDesign
    Inspiring
    June 9, 2015

    It can be done with HTML5 output.

    I have written and tested code to do exactly what you described. Out this in the head of the html. It uses Text_Entry_Box_1.

    It could be modified to show a message for a certain amount of time, then hide the message and the focus would go back to the TEB. Right now the focus goes to the alert.

    var interfaceObj;
    var eventEmitterObj;

    window.addEventListener("moduleReadyEvent", function(evt)
    {
    interfaceObj = evt.Data;
    eventEmitterObj = interfaceObj.getEventEmitter();
        initializeEventListeners();

    });

    function initializeEventListeners()
    {
    if(interfaceObj)
    {
         if(eventEmitterObj)
      {        
       window.cpAPIEventEmitter.addEventListener("CPAPI_VARIABLEVALUECHANGED",function(){
       testEntry();},"Text_Entry_Box_1");
      }
    }
    }

    function testEntry()
    {
    var getNum = window.cpAPIInterface.getVariableValue("Text_Entry_Box_1");

    if (getNum != 2)

      document.getElementById("Text_Entry_Box_1" + "_inputField").value = ""
      document.getElementById("Text_Entry_Box_1" + "_inputField").focus();

      alert("You must enter '2' in this field" )
    }
    }

    </script>

    Lilybiri
    Legend
    June 9, 2015

    No, I entered that feature request multiple times. You cannot control

    displayed value even if you change the associated value. You can this do

    using the latest version of the scrolling text interaction.