Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Display filename in text field

Avatar

Former Community Member
Hi, A simple question; how can I insert the pdf filename (without the file path) as a read only value in a text field. As this is not available as a Runtime property is there a script for this?



Thanks!



Sam
4 Replies

Avatar

Former Community Member
Yes ...use the command:

event.target.documentFileName

Avatar

Former Community Member
Thanks. However I don't seem to be getting anything - the field remains blank. I wonder if I am entering the command in the wrong place - can you offer any specific instruction on where this command should be placed? Cheers

Avatar

Former Community Member
In the initialize event for the text field, add the following client-side JavaScript:



this.rawValue = event.target.documentFileName;



Note, when you preview the PDF in Designer you will see an odd file name like _13fs18f3v9eeb3qs.pdf. When the PDF is opened in Reader or Acrobat you will see the real file name.