Copy link to clipboard
Copied
I am trying to figure out how I can put a full middle name in the forst field, but then it only produce the middle initial on certain pages following. Im also trying to do the same with a SSN- only the last 4 populate on certain pages. Can this be done?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It can be done by using slice() method.
To get four last numbers of SSN use like this in 'Custom calculation script' of
field where you want to show last four numbers:
var str = this.getField("SSN").valueAsString.slice(-4);
event.value = str;
To get first letter from middle name use slice(0,1).
Copy link to clipboard
Copied
Your first request is tricky to do correctly. I would advise against it because if you get it wrong people will be upset with you.
For example, if someone's middle name is John-Paul your script might identify it as one word and only use J as the initial, when in fact it's JP. It's best to let people decide for themselves how to write their own name.
Copy link to clipboard
Copied
For what I need it for, it's perfect if itnonly tranlates that one initial unless policy changes. Thank you for letting me know that though.