1 Reply Latest reply on Apr 4, 2014 1:55 PM by George_Johnson

    Trying to get a fourth field to populate based on the selection from three other dropdown menus.

    Ricky1947:)

      I would like the Treatment Classification field to populate with a combination of text and numbers based on my selection from three other drop down menus.

      For example:

      If I select "0-No Hurt" in the AHL field, "0-No Hurt in the PHL field, and "Near Miss in the Treatment Choice field, then the Treatment Classification field would populate to "L00NM".

      If I select "2-Moderate Hurt: in the AHL, "4-Fatality" in the PHL field, and "Restricted Work Incident" in the Treatment Choice field, then the Treatment Classifiaction field would populate to "L24RWI".

      If I select "1-Minor Hurt" in the AHL field, "4-Fatality" in the PHL field, and "Medical Treatment Incident" in the Treqatment Choice field, then the Treatment Classifiaction field would populate to "L14MTI".

       

      Etc, etc, etc.

      I could then fill in the resyt of the script with the required text.

      Capture2.JPG

      Capture.JPG

       

      Not sure how to load my PDF file.

      Thanks,

       

      Rick

        • 1. Re: Trying to get a fourth field to populate based on the selection from three other dropdown menus.
          George_Johnson MVP & Adobe Community Professional

          Do your dropdown list items currently have export values set up? It seems like the value you want to construct is simply concatenating the values of the three dropdowns, and this would be easy if you set the export values of the list items appropriately. For example, the export value for the "0-No Hurt" item would be 0 and for "Near Miss" it would be "NM", etc., so the script could look something like:

           

           

          // Get the values of the drop downs, as strings

          var v1 = getField("AHL").valueAsString;

          var v2 = getField("PHL").valueAsString;

          var v3 = getField("Treatment Choices").valueAsString;

           

          // Set this field's value

          event.value = "L" + v1 + v2 + v3 + "other text goes here."