Skip to main content
Known Participant
February 14, 2018
Answered

Drop down list selection displays a different value

  • February 14, 2018
  • 1 reply
  • 955 views

Hello,

I have an employee timesheet that I am trying to setup. Time is entered in per Phase Code that is set up by job (not every job we have uses the same sequence of codes). To make it easier for the guys in the field so they dont have to memorize each code and what it stands for, I would like the drop down menu to display the code plus the description of the code but when a selection is made only display the code number. (i.e. "201 - Metal Studs" is shown in the drop down selection but when selected only "201" is shown). Is this possible? There are anywhere from 5 to 100 codes for any given project.


To date, I havent tried anything and havent had luck finding anything online. Thanks in advance.

This topic has been closed for replies.
Correct answer Thom Parker

This script will work as long as the code is always 3 numbers and appears at the very front of the string.

Place this code in the custom "Format" script for the dropdown.

event.value = event.value.substr(0,3);

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
February 15, 2018

This script will work as long as the code is always 3 numbers and appears at the very front of the string.

Place this code in the custom "Format" script for the dropdown.

event.value = event.value.substr(0,3);

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Known Participant
February 16, 2018

Thom,

This did work in acrobat. However, I have a second hurdle which is that I am uploading this form to a construction software that sometimes doesnt recognize all the formulas and this one appears to be one of them. The software utilizes a 3rd party pdf view called PSPDFKit.

Any suggestions to either another way of getting it to work or a work around would be greatly appreciated.

thanks,

adam

try67
Community Expert
Community Expert
February 16, 2018

That would require finding out what works in that application and what doesn't, which can be a lot of work. It's likely there's no support at all for scripting in it.