6 Replies Latest reply on Feb 16, 2018 10:10 AM by adamr73245379

    Drop down list selection displays a different value

    adamr73245379 Level 1

      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.

        • 1. Re: Drop down list selection displays a different value
          Thom Parker Adobe Community Professional

          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);

          • 2. Re: Drop down list selection displays a different value
            adamr73245379 Level 1

            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

            • 3. Re: Drop down list selection displays a different value
              try67 MVP & Adobe Community Professional

              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.

              • 4. Re: Drop down list selection displays a different value
                adamr73245379 Level 1

                try67,

                 

                You are correct and I have been sending reports to the construction software's staff about each incident. But some script has worked and actually they tout how they have incorporated some basic script to work with their software for such things as project name and project number. What has worked for me to date are calculation scripts and if/then scripts. This was my first attempt at a drop down format script which they probably haven't developed yet on their end.


                I appreciate all the feedback and will try some things out myself if I don't hear back from anyone more on this.

                 

                 

                Thanks to all,

                Adam

                • 5. Re: Drop down list selection displays a different value
                  Thom Parker Adobe Community Professional

                  3rd party PDF viewer companies will usually provide a list of JS objects, functions, and properties they support. Unfortunately the issue here is which events they support.  The Format script is pretty simple. If it doesn't work, then they do not support this event, and this won't work for your form.

                   

                  I would suggest a couple of different approaches.

                  1. Make the drop down so small that only the code is visible.

                  2. Place a field next to the dropdown for displaying the code, then use a calculation script to set the value of the field to the code. It is highly likely that if they support any scripting that they support the Calculation event.

                  • 6. Re: Drop down list selection displays a different value
                    adamr73245379 Level 1

                    Thanks Thom,


                    I was actually going to do that before I originally posted. I think I may have to do that if it becomes too much of a bother. The other thing I was thinking was to just make the form field small enough to where it just display 3 digits and set the justification to the left.

                     

                     

                    Thanks for all your help,

                    Adam