Skip to main content
Participant
Aug 14, 2019 4:14 PM UTC
Answered

Printing the last digits of a textbox

Guys, I have a pretty simple question, but I've no idea about writing command in JS.

The thing I'm trying to do is to print in a textbox the last five digits of another textbox. Something like this:

in my first textbox, I have this serial number: FTFYIOI66779995, and I want to print the last 5 digits: 79995 in other textbox.

Hope I explained myself right And thanks for your help

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Aug 14, 2019 4:23 PM UTC

If the first field is called "Text1" you can use the following code as the custom calculation script of the second field:

event.value = this.getField("Text1").valueAsString.substr(-5);

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Aug 14, 2019 4:23 PM UTC

If the first field is called "Text1" you can use the following code as the custom calculation script of the second field:

event.value = this.getField("Text1").valueAsString.substr(-5);

Translate
Participant
Aug 14, 2019 4:54 PM UTC

Thank you! It worked perfectly

Translate