Forum Discussion
to write only letters in textentry and not numbers
Hello, is it possible to write only letters in textentry and not numbers? Thank you
- mahbag-e8b66d7eCommunity Member
????
- NedimCommunity Member
It's doable with a JavaScript hack.
- mahbag-e8b66d7eCommunity Member
Hi thanks.please more explain.
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! ✨
- NedimCommunity 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.- mahbag-e8b66d7eCommunity Member
- mahbag-e8b66d7eCommunity Member
- NedimCommunity Member
See the attached story. The code is in the Execute JavaScript trigger.
- mahbag-e8b66d7eCommunity Member
Hi thanks.Excellent.The problem is that you can't write numbers in Numericentry.