Skip to main content
Participating Frequently
March 12, 2015
Question

Make Text Entry Box automatically proceed to next slide when valid entry is typed

  • March 12, 2015
  • 4 replies
  • 464 views

I have a text entry ox that I want to use to control movement in my project.

If the user types any of the correct entry options I have entered, I want it to automatically proceed to the next slide, rather than having to click a button or press a keyboard shortcut.

Is this possible?

MM.

    This topic has been closed for replies.

    4 replies

    c-dudeAuthor
    Participating Frequently
    March 28, 2015

    Hi all,

    I was trying to replicate an Address field in the system where it lists all possible addresses underneath the text field as you start typing it. I only wanted the first 9 characters to be entered by the user, so the "limit characters" and "auto submit" options worked perfectly.

    Thanks for suggesting... never knew those options were available!

    M

    Participant
    March 12, 2015

    In the TEB properties, under More Options, I think the Maximum Length and Auto-Submit options will help you achieve what you want to do.

    TLCMediaDesign
    Inspiring
    March 12, 2015

    That would only work if the possible entries were of the same length.

    TLCMediaDesign
    Inspiring
    March 12, 2015

    Since the TEB has an associated variable, you could use the event CPAPI_VARIABLE
    VALUECHANGED
    to monitor the variable and if it equals your text navigate to the next slide.

    You need to be using CP8.

    If you put the following in the head of the html page it will do what you want, type "jump" in the TEB and it will alert "do something"

    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 checkText = window.cpAPIInterface.getVariableValue("Text_Entry_Box_1");

    if (checkText == "jump")
    {
      alert("do something")
    }
    }

    Lilybiri
    Legend
    March 12, 2015

    The entry in a TEB has always to be confirmed by the user, which is logical because only the user can decide when he has finished his entry. Confirmation can be done by the Submit button or by a shortcut key, like Enter. You cannot escape from that. CP cannot guess how many characters the user wants to type in, right?

    As for the action: since the TEB has to be validated, just add the command Go to Next Slide to the Success action of the TEB. I don't know what you want to do with the Failure action?

    Participant
    March 12, 2015

    In the TEB properties, under More Options, I think the Maximum Length and Auto-Submit options will help you achieve what you want to do.

    Lilybiri
    Legend
    March 12, 2015

    That will only work when all the correct entries have exactly the same number of characters.