Forum Discussion
Trigger for Text Entry to Play Screen Recording Action
- 7 days ago
You're missing one closing brace for the second if block.
Here’s the corrected code with proper closing braces:
const Inputs = () => { const inputs = document.querySelectorAll('.acc-textinput'); inputs.forEach((input) => { input.setAttribute('maxlength', '10'); input.disabled = false; input.addEventListener('keyup', () => { let text = input.value; if (text.length === 10) { if (text[8] === '4' && text[9] === '4') { setVar('valueCorrect', true); console.log('Valid number: Correct placement of 4'); } else { console.log('You must enter the correct Provider NPI.'); setVar('error', true); // setting storyline variable 'error' to true after invalid entry input.disabled = true; // disable number after invalid entry } } }); }); }; setTimeout(Inputs, 100);
It's definitely doable. Here's how it could look using JavaScript with number entry instead of text entry. Let me know if this solution works for you, and I'll gladly help you set it up. I understand not everyone is comfortable using JavaScript in their projects. I just don’t see another way to achieve this at the moment. Adding functionality to show an "error" layer would require a few more tweaks, but it’s not essential for this to function as intended.
- ShannonTeam-80530 days agoCommunity Member
Nedim, yes, I knew it would require JavaScript, which I’ve never tackled but am interested in learning. I am thinking it would require writing the script for the specific number or requiring the user to enter an 8-digit string ending in 3. The second option wouldn’t require the exact number, but the nature of the simulation would result in users typing the right number even if the entire thing isn’t specified in the script. I have used a workaround for now, as I needed to meet a deadline, but I would love some guidance on an actual fix for future projects, as I am likely to encounter this again.