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

Captivate text entry fields

Community Beginner ,
Jun 09, 2015 Jun 09, 2015

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

220
Translate
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 ,
Jun 09, 2015 Jun 09, 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.

Translate
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
People's Champ ,
Jun 09, 2015 Jun 09, 2015
LATEST

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>

Translate
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