Expand my Community achievements bar.

SOLVED

Populate field with File Name

Avatar

Level 2

Is there any way to have a text field populate with the pdf's file name?

Example - File name  -   Incident-11223.pdf

When the user opens the PDF, Text Box 1 has "Incident-11223" pre filled in.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi,

Try this one. In the docReady event of the TextField put this script.

this.rawValue = event.target.documentFileName;

Thanks.

Bibhu.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 9

Hi,

Try this one. In the docReady event of the TextField put this script.

this.rawValue = event.target.documentFileName;

Thanks.

Bibhu.

Avatar

Level 2

Awesome, That works really well.

I found this on the forum based on your answer.

Puts the file name in the field and takes off the .pdf extention.

var

fileName = event.target.documentFileName;

//removing the file extension

var

vDot = fileName.length-4;

//apply the value to the TxtField

this.rawValue

= fileName.substring(0,vDot);

Avatar

Level 2

I  found the Javascript to remove the File Extention from another post on the Forum.

It is working great, thank you very Much!

var

fileName = event.target.documentFileName;

//removing the file extension

var

vDot = fileName.length-4;

//apply the value to the TxtField

this.rawValue

= fileName.substring(0,vDot);