2 Replies Latest reply on Jun 13, 2014 4:05 AM by New Guy 40

    How do I add and remove text in a text field with a checkbox?

    New Guy 40

      How do I add and/or remove text in a text field with a checkbox?

       

      this is my script in the text box......

       

      event.value="Hello, this is my narrative. \r\n\nFamily: \r\n\n" + this get.Field("FirstName").value + " " + this.getField("LastName").value + was born on"=this.getField("DOB.value + "\r\n\n + this.getField("drpField").value + "\r\n\n" + this getField("Father").value

       

      The text box looks like this...

       

      Hello, this is my narrative.

       

      FAMILY:

       

      John Smith was born on 08/02/2000

       

      Boby Lou

       

      Jack Smith

       

       

      I need to add/or remove the father field (Jack Smith) & r/n/n with a check box.

       

       

      Does anyone know how to do this?

        • 1. Re: How do I add and remove text in a text field with a checkbox?
          try67 MVP & Adobe Community Professional

          There are multiple errors in your code...

           

          Use this code instead (adjust the name of the check-box):

           

          var msg = "Hello, this is my narrative. \r\n\nFamily: \r\n\n" + this get.Field("FirstName").value + " " + this.getField("LastName").value + was born on" + this.getField("DOB.value) + "\r\n\n" + this.getField("drpField").value;

           

          if (this.getField("FatherCheckBox").value!="Off")

               msg += "\r\n\n" + this getField("Father").value;

           

          event.value = msg;

          • 2. Re: How do I add and remove text in a text field with a checkbox?
            New Guy 40 Level 1

            With my application, I don't want msg to display anything in the text field, if the check box is Off.  So if FatherCheckBox is Off, and MotherCheckBox is Yes, only the mother information will be shown.

             

            For example, msg is for FatherCheckBox(not checked) and msg2 is for MotherCheckBox(Checked)

             

            event.value=msg + msg2

            Therefore, only the Mother information will be shown.

             

            How do I do this?