Following this thread:
var p = GetPlayer();
var textentry = p.GetVar("TextEntry");
var newTextentry = textentry.replace(/^\s+|\s+$/g, '');
I managed to copy the script to remove spaces from a text entry field called "TextEntry".
However, I would like to be able to iterate this through multiple text entry fields, which get names like "TextEntry1", "TextEntry2", etc etc.
Presumably I need some kind of loop, which appends a number to "textentry", "TextEntry", "newTextentry", and cycles through it until the nth iteration, but I don't know how to code this, and can't find an answer anywhere.
I hope this makes sense, and apologize if I've posted in the wrong place.