Forum Discussion

mahbag-e8b66d7e's avatar
mahbag-e8b66d7e
Community Member
2 years ago

to write only letters in textentry and not numbers

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

  • Hi mah, 

    This is something outside of the scope of our expertise. 

    I'm curious to hear what Nedim and others who pop into this thread could share as a workaround!

    Have a great start to your week! ✨

  • Nedim's avatar
    Nedim
    Community Member

    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.