to write only letters in textentry and not numbers

Oct 01, 2023

Hello, is it possible to write only letters  in textentry and not numbers? Thank you

9 Replies
Nedim Ramic

Hi mah bag,

Create an Execute JavaScript trigger When the timeline starts on this slide.
In the JavaScript Editor, copy and paste the code below:

const inp = document.querySelector('.acc-textinput')
inp.addEventListener('input', function(event) {
  // Modify the input field value to remove any non-alphabetic characters
  event.target.value = event.target.value.replace(/[0-9]/g, '');
}); 

This will work if you only have one TextEntry field on your slide. If you have more than one TextEntry field, the code needs  to be adjusted to loop through all input text field to apply the same functionality. I suggest you to play with this code first, see what it does before you move on to something more complex. Keep in mind that the JavaScript code will not run in the Storyline preview, it has to be published to Review 360, Web or LMS in order to see it in action.