Forum Discussion

SuzanneNeafus's avatar
SuzanneNeafus
Community Member
3 months ago

Can you restrict or convert the text in a data entry input field?

Is there a way to have the entry automatically be a capital letter and or convert it after it has been entered? 

What I am trying to accomplish is to have 3 sentences on the screen, and for each, the user is to select their choice of A, B, or C.  I will then verify if for sentence 1 they selected A, for sentence 2 they selected B, and for sentence 3 they selected C.  

I originally thought to do 1 test with 3 if statements, but that will not work if I have to factor in upper- or lower-case entries.  For now, I will have to check each item for the upper or lower case and then a last test to see if all 3 entries were correct. 

In typing this, the ideal situation would be to have a drop-down of A, B, or C - but I am guessing that is not possible. (I have a programming background, so even if it requires JavaScript, that would be okay).

Thanks

Suzanne

 

  • JesseWu's avatar
    JesseWu
    Community Member
    var player = GetPlayer();
    
    // Convert variables optionA, optionB, and optionC to lowercase
    ["optionA", "optionB", "optionC"].forEach(function(variable) {
        player.SetVar(variable, player.GetVar(variable).toLowerCase());
        //if you want to convert to uppercase, replace with player.SetVar(variable, player.GetVar(variable).toUpperCase());
    });

     

    • SuzanneNeafus's avatar
      SuzanneNeafus
      Community Member

      Thank you so much.   It is much easier for me to add this and only have to process capital letter inputs.  Take care - Suzanne