2 Replies Latest reply on May 24, 2010 6:28 AM by jimdandy1956

    Send one of 5 checkbox values to a text field

    jimdandy1956

      I am trying to send the checked value of one of six checkboxes to a text field and just can't work it out.  Can anyone help me.

      Here is the script I have been trying to work with.  I know it is wrong because it doesn't work.

       

      var Architect = getField("Arch Chkbx")
      var Engineer = getField("Eng Chkbx")
      var Landscape = getField("Land  ChkBx")
      var Interior = getField("Int Chkbx")
      var Other = getField("Other Chkbx")

      if (Architect == "Architect") {
      event.value="Architect";
      }
      else if (Engineer == "Engineer") {
      event.value="Engineer";
      }
      else if (Landscape == "Landscape Arch.") {
      event.value="Landscape Architect";
      }
      else if (Interior == "Interior Designer") {
      event.value="Interior Designer";
      }
      else if (Other == "Other Designer") {
      event.value="Other Designer";
      }

        • 1. Re: Send one of 5 checkbox values to a text field
          gkaiseril MVP & Adobe Community Professional

          Have you looked at the JavaScrpt console to see if you are getting any errors reported in your script?

          JavaScript is an 'object' orientated language. You need to identify an object and then access a property or methods of that object. 'event' is an object and it has a property of 'value'. So the code 'event.value = 'string';' sets the current event's value to the character string 'string'. The 'this' is the current PDF document. 'getField' is a method of that object that obtains a named field object. Once you have that object, you need to use '.value' property to obtain the value of the named field

          .

          If you want the check boxes to be exclusionairy, only one selection allowed, you should give them all the same name and assign different export values.

          function(){return A.apply(null,[this].concat($A(arguments)))}

          var Architect = this.getField("Arch Chkbx").value;
          var Engineer = this.getField("Eng Chkbx").value;
          var Landscape = this.getField("Land  ChkBx").value;
          var Interior = this.getField("Int Chkbx").value;
          var Other = this.getField("Other Chkbx").value;

          else event.value ='';

          if (Architect == "Architect") {
          event.value  = "Architect";
          }
          else if (Engineer == "Engineer") {
          event.value = "Engineer";
          }
          else if (Landscape == "Landscape Arch.") {
          event.value = "Landscape Architect";
          }
          else if (Interior == "Interior Designer") {
          event.value = "Interior Designer";
          }
          else if(Other == "Other Designer") {
          event.value="Other Designer";

          • 2. Re: Send one of 5 checkbox values to a text field
            jimdandy1956 Level 1

            I got it to work using your suggestion and giving them all the same name and assign different export values.  Thanks for the recommendation.

            Here is the code that works.  Thanks again GKaiseril!

             

            function(){return A.apply(null,[this].concat($A(arguments)))}

            var License = this.getField("Check Box10.0").value;

            if (License == "Architect") {
            event.value  = "Architect";
            }
            else if (License == "Engineer") {
            event.value = "Engineer";
            }
            else if (License == "Land") {
            event.value = "Landscape Architect";
            }
            else if (License == "Interior") {
            event.value = "Interior Designer";
            }
            else if(License == "Other") {
            event.value="Other Designer";
            }
            else event.value ='';