Forum Discussion
Help for interaction in text insert field
Hi Claudia,
Here is another one for you.
The input is validated and limited to 4 characters. The first character must be correct (for example, a specific letter like 'B'). If the first character is correct, the first level is unlocked, and the user can proceed to type the second character. If the first character is incorrect, the user cannot proceed. Once the first character is correct and the first level is unlocked, the second character, which must also be correct (e.g., '2'), can be typed. If the second character is correct, the second level is unlocked. If the second character is incorrect, the user cannot proceed. When the first two characters are correct, the third character (e.g., '4') can be typed, and if it’s correct, the third level is unlocked. If any of the previous characters are incorrect, the user cannot proceed. Finally, once the first three characters are correct, the user can type the fourth character (e.g., '6'). If the fourth character is correct, the fourth level is unlocked. If any characters are deleted, all levels are locked again, and the user will need to re-enter the correct sequence to unlock them once more. Or you can simply disable text entry once the correct combination is entered and the fourth character is correct.
Hi Nedim, thank you for your answer, too.
Do you also use javascript? Perhaps I make a mistake but I cannot copy your idea to involve it in my story. Could you send me a story-file?
- Nedim2 months agoCommunity Member
Yes, I use JavaScript to enhance the text entry field functionality. Specifically, I limit the maximum allowed characters to 1 initially and then increase the limit by 1 for each correctly typed character, up to a maximum of 4 characters.
Additionally, JavaScript allows me to update the text entry value in real-time as the user types, rather than waiting for the field to lose focus. While it's possible to achieve this functionality without JavaScript, it would be more complex and less user-friendly. Without JavaScript, the user would need to click outside the text entry field to trigger validation and update the value after each character is entered.
I also use Storyline True/False variables (e.g., Level1, Level2, etc.) For each correctly typed character, I set the corresponding variable to True in my JavaScript code. Based on the values of these variables, I unlock the level buttons accordingly.
The implementation might be a bit complex and could definitely be simplified with less code if needed. My main goal is to ensure that all levels are unlocked if the user types all characters correctly. However, if the user enters an incorrect character, the levels are immediately locked again.
I've attached my .story file. Let me know if you need further assistance with adjusting the code.- ClaudiaGlase2 months agoCommunity Member
Thank you for attaching the story. The aspect to update the text entry value in real-time is interesting. I did same visiual basic in excel long ago so I understand your java script roughly and can adjust it to my purpose.