Forum Discussion
PaulRead-a838f3
6 years agoCommunity Member
Remove/Ignore spaces at the end of multiple text entry fields - Javascript question
Hi I wonder if any Javascript wizards can help? Following this thread: https://community.articulate.com/discussions/articulate-storyline/remove-ignore-spaces-at-the-end-of-text-entry-fields
var...
PaulRead-a838f3
5 years agoCommunity Member
Hi
Yes, I got there in the end...!
This script will run through the variables TextEntryX to TextEntryY (you can specify the first and last in the series by changing X and Y below to numbers) and replace the input in each of those variables with a "cleaned up" version with spaces and apostrophes etc removed.
var p = GetPlayer();
for(var i = X; i < Y; i++) {
var textentry = p.GetVar("TextEntry" + i);
var newTextentry = textentry.replace(/^\s+|\s+$|\'/g, '');
p.SetVar("TextEntry" + i,newTextentry);
}
- NadiaPicco-d87b5 years agoCommunity Member
Oh brilliant! Thank you so much :)