5 Replies Latest reply on Jan 24, 2018 1:39 PM by Thom Parker

    How to refer to dropdown not by name

    joshual57966311 Level 1

      I have a series of dropdowns that I want to attach the same script to that basically makes a "notes" textfield required if the dropdown value is "fail" (and makes it not required if it is "pass"). The script I have for one of the dropdowns is:

      var result = this.getField("Dropdown5");

      var notes = this.getField("Text14");

      if(result.value == "Fail"){

          notes.required = true;


          notes.required = false;


      on mouse exit and it works fine but I was wondering if there is some other way to reference the dropdown that the script is attached to besides using the name. I know this refers to the pdf, but is there some other javascript construct or something to refer to the currently attached field? This way I won't have to edit a bunch of different scripts just to change the name and I can just do a copy/paste. OR is there some way to do this with a document script? I tried making one but nothing happened when I changed any dropdowns.