Forum Discussion

JonasGretzer's avatar
JonasGretzer
Community Member
2 years ago

Clear numeric entry boxes / reset numeric variables - Storyline 360

I have created an exercise where the learner need to fill in three numeric entry boxes. If they don't answer correctly I want to clear the boxes when they are to retry the excercise. However I cant understand how I can set the numeric variables to blank. If I set them to "0" then 0 is displayed in the entry boxes. I think the only solution would be to use javascript?

Would anyone be able to provide me with what code to use? :)

  • JonasGretzer's avatar
    JonasGretzer
    Community Member

    I got it to work now. Using this js-code
    var player = GetPlayer();
    player.SetVar("variable1", "");
    player.SetVar("variable2", "");
    player.SetVar("variable3", "");

    But now "NaN" is displayed in the entry boxes. Do anyone have a solution for this..?

  • JS returns text content to SL variables. "" is text, so you get "NaN (Not a Number").

    If the variables are set to a default value of blank, when you revisit the slide, the entry boxes should be blank if the slide is set to return to initial state on revisit. You may need to set the variables to 0, but I don't think so.

    • JacekKuczyns045's avatar
      JacekKuczyns045
      Community Member

      Walt, it's not possible to reset "numeric entry" into blank. 

      Jonas, can you use the text entry instead? If so, you can reset them into blank. 

  • Jacek,

    You're right, you can't reset them to blank. What I was thinking of  is that if they have a default value of 0, they show blank, but only until they receive a value. So Jonas would have to restart the course to get them blank.

  • JonasGretzer's avatar
    JonasGretzer
    Community Member

    Thank you both for reply!

    I don't want to use text entry so I now set them to 0. It is not perfect, but this will do for this time!