Forum Discussion
Text Entry-Three Fields
- 3 months ago
I played around and found out: there is a curly bracket missing at the end of your numpad scripts. Any script error will disable all scripts from working.
var player = GetPlayer();
var DCID_Ongoing = player.GetVar("DCID_Ongoing");
var DCIDInput = player.GetVar("DCIDInput");
var DriverID_Ongoing = player.GetVar("DriverID_Ongoing");
var DriverIDInput = player.GetVar("DriverIDInput");
var TractorNum_Ongoing = player.GetVar("TractorNum_Ongoing");
var TractorNumInput = player.GetVar("TractorNumInput");
if (DCID_Ongoing == true) {
DCIDInput += "0";
player.SetVar("DCIDInput", DCIDInput);
} else if (DriverID_Ongoing == true) {
DriverIDInput += "0";
player.SetVar("DriverIDInput", DriverIDInput);
} else if (TractorNum_Ongoing == true) {
TractorNumInput += "0";
player.SetVar("TractorNumInput", TractorNumInput);
} //<-- This is the bracket you missed.For your testing, disable all other scripts. Fix one of them. If it works, copy to and enable others back on. Inspect the console on the preview panel helps you figure out what could be wrong :)
Once they are all set, you can add your original backspace and clear buttons back. I didn't try them because I am lazy. It just changes one line of code.
Hello,
Based on your user story, I tried a solution on another page:
(1) Add 3 True/False variables to monitor which input element our user is focusing on. When user is focusing on A, make monitor on B and C false, and so on.
These monitors will be triggered by both: user manually click on next field or use "next" button.
(2) With the monitors, the shared keypad now will append characters to the only active input variable. I only coded for 4 buttons for the test reason, but it works as I expect when I input with clicking keypads only or mixing keypad with keyboard.
(3) Button "verification" will check inputs and show slides as desired.
I didn't delete my testing references. I hope it makes it easier for you to catch some thoughts.
Bug: because of how I coded, when you tried to change a number in the middle, like "2" in 123 to 143, the numpad won't do, getting you a 1234 instead, because it is not designed to follow users' cursor.
- StefanieKirs7433 months agoCommunity Member
Hi Jesse,
Thank you SO much! This is genius! I got started based on your example, and despite doing it the exact same way, my numbers won't appear. Can you look at this updated one and see what I'm missing?
- JesseWu3 months agoCommunity Member
I played around and found out: there is a curly bracket missing at the end of your numpad scripts. Any script error will disable all scripts from working.
var player = GetPlayer();
var DCID_Ongoing = player.GetVar("DCID_Ongoing");
var DCIDInput = player.GetVar("DCIDInput");
var DriverID_Ongoing = player.GetVar("DriverID_Ongoing");
var DriverIDInput = player.GetVar("DriverIDInput");
var TractorNum_Ongoing = player.GetVar("TractorNum_Ongoing");
var TractorNumInput = player.GetVar("TractorNumInput");
if (DCID_Ongoing == true) {
DCIDInput += "0";
player.SetVar("DCIDInput", DCIDInput);
} else if (DriverID_Ongoing == true) {
DriverIDInput += "0";
player.SetVar("DriverIDInput", DriverIDInput);
} else if (TractorNum_Ongoing == true) {
TractorNumInput += "0";
player.SetVar("TractorNumInput", TractorNumInput);
} //<-- This is the bracket you missed.For your testing, disable all other scripts. Fix one of them. If it works, copy to and enable others back on. Inspect the console on the preview panel helps you figure out what could be wrong :)
Once they are all set, you can add your original backspace and clear buttons back. I didn't try them because I am lazy. It just changes one line of code.
- StefanieKirs7433 months agoCommunity Member
Jesse THANK YOU THANK YOU so so much!!!!