Skip to main content
timothyd19876369
Participant
January 22, 2021
Question

automatically Checkbox Checked if filename contains specific word (adobe dc javascript)

  • January 22, 2021
  • 1 reply
  • 476 views

Hi,

I am hoping someone maybe able to help. I have been looking through but nothing is specifically working for what I need.

I basically have a pdf with some document level javascript but would like to add some more.

Basically there are 5 checkbox each saying a deptartment like 'Finance'

I was wondering if I could get the checkbox to check when the document is automatically opened and it looks for specific string that contains (so it might have other text around it) "Finance"

 

So for example Filename: 'Document Invoice - Finance - 1234.pdf'

Ideally because the document title includes finance it would automatically check the textbox called 'Finance' on the PDF form? If finance wasn't there it wouldn't check the box at all

Any help would be much appreciated.

 

Many thanks,

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
January 22, 2021

Sure, that's possible. You can do it using this script:

this.getField("Finance").checkThisBox(0, /Finance/.test(this.documentFileName));

timothyd19876369
Participant
January 30, 2021

Hi Try67,

 

This is amazing 🙂 Thank you so much worked first time no problems at all!