3 Replies Latest reply on Dec 19, 2008 10:11 AM by evil8

    Newb deserving assistance with Adobe Javascript (check boxes and combo boxes)

      Hi, I'm a newb when it comes to javascript (using adobe acrobat pro 6.0).

      I am working on a form that will allow me to autofill checkboxes based off of information chosen. Ideally, I would like to have a selection from a combo box autofill/auto checkmark check boxes. Alternatively, I would be willing to just have different selections presented with check boxes that when filled, would auto checkmark other check boxes (I know how to do this one, but I am not sure how to clear the check boxes if the initial one is unchecked).

      I have the action button tied to the mouse up function. This just errors out.

      var Citrix = this.getField("Citrix")
      var Appro = this.getField("Appro")
      var SAS = this.getField("SAS")

      if (event.target.value=="Yes") {

      Citrix.checkThisBox = true
      Appro.checkThisBox = true
      SAS.checkThisBox = true
      }

      else {
      Citrix.checkThisBox = false
      Appro.checkThisBox = false
      SAS.checkThisBox = false
      }

      I have this that works, but I don't know how to clear the buttons when "Associate" is unchecked.

      if(this.getField("Associate").isBoxChecked(0));

      {
      this.getField("Citrix").checkThisBox(0, true);
      this.getField("Appro").checkThisBox(0, true);
      this.getField("SAS").checkThisBox(0, true);
      }

      The other way I was working on it, was to use a combo box to autofill/checkmark check boxes. But this code doesn't work either.

      function calculateTextField()
      {
      // get the value of the combo box
      var comboValue = this.getField("Select").value;
      // get the state of the checkbox
      var isChecked = (this.getField("Citrix").value == "Yes");

      var textFieldValue = "";
      console.println(comboValue);

      if (isChecked)
      {
      if (comboValue == 0)
      {
      textFieldValue = "";
      }
      if (comboValue == "Associate")
      {
      (this.getField("Citrix").value == "Yes");
      }
      else if (comboValue == "Specialist")
      {
      (this.getField("Citrix").value == "Yes");
      }
      else if (comboValue == "Team Leader")
      {
      (this.getField("Citrix").value == "No");
      }
      else
      {
      (this.getField("Citrix").value == "No");
      }
      }
      else
      {
      textFieldValue = "";
      }

      this.getField("Select").value = textFieldValue;
      }

      Can anyone please assist me with this?

      Thanks,
      Chris