Inserting a comma and whitespace
So I've been working at this for awhile. The situation is that users complete a form inputting their Last name, First name MI. The problem is they're supposed to include the comma between the Last name and First name but sometimes they don't. I tested the code below in W3Schools.com "Tryit Editor", and it works fine. It just doesn't in my PDF file. Here is what I have so far:
function fComma() {
var str = this.getField("01: Name").value;
var res = str.replace(/,|\s+/, ',\n')
this.getField("01: Name").value = res;
}
And I also don't know where to place the function. I currently have the function at document level and tried calling it from the Actions tab, the Format tab in Custom Format Script, and I tried it in the Custom Validation Script tab. None of them are working so I'm betting the script is messed up.
Please help.
