Copy link to clipboard
Copied
I am working on a document that creates fields. I am using a counting variable to append unique integers to created fields, e.g. topPh4, newPage4, etc. I want to have a button read its own name, figure out the integer attached to it, then look for fields with the same number. I know I could use
right(button, XX)
only the number will often (but not initially) be 2 digits. Is there a method to get the number, however many digits, from the name? I can imagine using some if statements to check the end for integers, and when found, concatenate them, but its seems brutish. Any better ideas?
Copy link to clipboard
Copied
What you posted looks nothing like Acrobat JavaScript. Is that what you're referring to?
If so, you can use this: event.target.name.match(/\d+$/)[0]
Copy link to clipboard
Copied
What you posted looks nothing like Acrobat JavaScript. Is that what you're referring to?
If so, you can use this: event.target.name.match(/\d+$/)[0]
Copy link to clipboard
Copied
I shouldn't have used the code tags since it wasn't real code. I was referring to the "right" method for strings... But I then came across regular expressions and knew I was getting close. Thanks for the help.
Copy link to clipboard
Copied
There's no "right" method in JavaScript. You must be thinking of VBA or something like that.
Copy link to clipboard
Copied
Mm the string function right? Is that more accurate?
Copy link to clipboard
Copied
This is not the documentation of Acrobat JavaScript. It's for ColdFusion's CFML.
"function" and "method" are synonyms, for the most part.
Copy link to clipboard
Copied
Well.... that's embarrassing...

