3 Replies Latest reply on Feb 15, 2016 11:12 AM by jims10931127

    If yes, text should display texta, if no, text should display textb on form

    jims10931127

      I have a form, that if you select yes, phrase one will appear,  if you select no, phrase 2 will appear.

       

      I have one check box called "choice" and an empty text box called texBox.

      I have tried these javascripts: inside Actions -> Mouse Up -> Run a javaScript.

      Using Adobe Acrobat Pro DC

       

      --------------------- attempt 1 --------------------------

      var f = this.getField("choice").value;

       

      if(f ="yes")

      {textBox.value = "yes";}

      else if(f !== "yes")

      {textBox.value ="no";}

       

      So If I click on the check box, the box should say yes.

      -------------------- attempt 2 -------------------------

      another attempt, using differant variables then above.

       

      var g = this.getField("clickMe2").value;

      if(g){textBox2.value = "true";}

      else{textBox2.value = "false";}

       

      -------------- attempt 3 using a drop down for yes and no  (would not want to do it this way) -----------------------

      var h=this.getField("List Box8").value;

      if(f =="Yes"){

      this.getField("Text9").value = "YYes";}

      if(f == "No"){

      this.getField("Text9").value = "NNo";}

       

      This seems so simple, but apparently not.   Please advise.

       

      I would prefer the check box to be a pair of radio buttons,  labeled yes and no, but that did not work, so thought it would be easier just to do a check box labeled yes. which would default at No.

      I would really prefer all of the questions on page one only to appear if yes was selected, but again, too complicated for me at this point.