2 Replies Latest reply on May 30, 2013 10:14 AM by nickernest

    Question regarding condtional checkboxes...

    nickernest

      Hi and thanks in advance to anyone who puts any time into this helping me!!!

       

      I have created a contract for my business that allows our employees to complete orders using a fillable PDF. As of right now, if my employee has a 6-month order that repeats itself (months 2-6 has the same details as month 1), they have to enter these details in 6 times.

       

      I'm trying to create a checkbox for months 2-6 that, if checked, would duplicate the details for month 1. If someone could steer me in the right direction, I know I could figure it out.

       

       

      Although there are 20+ fields that need to be duplicated, I'm just wanting to figure this out for 1 first, then I'm near positve I could figure the rest out...

       

       

      Here's what I've tried:

       

      For Reference

      SameCB2 = checkbox that when checked will duplicate details from month 1 to month 2

      Month1CB = checkbox requesting certain service for month 1

      Month2CB = checkbox requesting certain service for month 2

       

      So I want it to be where if "SameCB2" is checked, Month2CB will equal Month1CB (if Month1CB is checked, Month2CB will be checked; if Month1CB is unchecked, Month2CB will be unchecked)

       

      I went into the properties for SameCB and added the following Mouse Up action Javascript:

       

      var nSameCB2 = this.getField("SameCB2").value;

      var nMonth1CB = this.getField("Month1CB").value;

      var nMonth2CB = this.getField("Month2CB").value;

       

      if(nSameCB2 == "Yes") nMonth1CB === nMonth2CB;

       

      I know that this is dead wrong, but I honestly don't know what else to try. I've tried searching all over the web to try and find bits and pieces of info that could help me with this, but I couldn't find any examples that came close.

       

      Any direction with this would be GREATLY APPRECIATED!!!!!

       

      Thanks,

      Nick

        • 1. Re: Question regarding condtional checkboxes...
          try67 MVP & Adobe Community Professional

          1. The assignment operator is "=", not "===". That's a more strict form of the comparison operator "==".

          2. To assign a new value to a field you have to access it directly, or through a variable that points to the field object.

          Changing the value of a string object that has the field's value will not change the actual field itself.

           

          So replace this line:

          if(nSameCB2 == "Yes") nMonth1CB === nMonth2CB;

           

          with this:

          if(nSameCB2 == "Yes") this.getField("Month1CB").value = nMonth2CB;

          • 2. Re: Question regarding condtional checkboxes...
            nickernest Level 1

            Thanks Gilad D for the Help! This did push me in the right direction! You are awesome for taking the time to help a new Acrobater out!

             

            I had to swap the "Month1CB" and the nMonth2CB so that it read:

            if(nSameCB2 == "Yes") this.getField("Month2CB").value = nMonth1CB;

             

            But after that minor change, It works perfectly. Thanks again so much for your help!