Forum Discussion
ShannonTeam-805
31 days agoCommunity Member
Trigger for Text Entry to Play Screen Recording Action
I am working on a simulation in which I need the screen recording action to play when a specific number is entered into a text entry field. I don't want the user to have to click anywhere else, as th...
- 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);
ShannonTeam-805
Community Member
Nedim, I'm trying to replicate what you did using slightly different criteria and a different result. I used a 10-digit number, and the 9th and 10th digits must be 4. The resulting action is the slide transitions to the next slide. This isn't working. Can you take a look?
Nedim
7 days agoCommunity Member
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);
- ShannonTeam-8057 days agoCommunity Member
Thank you!