11 Replies Latest reply on Jan 9, 2013 1:16 PM by leahcar8

    PDF Form Summary

    leahcar8

      Hello,

       

      I have a rather lengthy pdf form that contains a combination of check boxes and radio button groups.  At the end, I would like to create a summary of everything that was selected in the form.  The form is to select options for a product...like a car.  So using that analogy, the summary would be like the window sticker you'd find on a car.

       

      I'm not sure where to start.  At first, I was going to just put a copy of each field on a page minus all the option descriptions, but it would be really nice to just show what was actually selected.  ...and I realize that I could just make all the un-selected fields invisible in the summay, but that would leave white space in the page. 

       

      Any suggestions on how I could handle this?  I've googled and googled, but I'm not having much luck. 

       

      Thanks!

        • 1. Re: PDF Form Summary
          try67 MVP & Adobe Community Professional

          You can copy the selected values of check-box or radio button group to a

          text field using a simple calculation script, like so:

          event.value = this.getField("Radio1").value;

          Set that text field as read-only and you're basically done...

          • 2. Re: PDF Form Summary
            leahcar8 Level 1

            Thanks for the reply...

             

            If I did that, then wouldn't I have to create a new text field for each check box option and radio group?  If so, then if the customer did not check some of the check box options, then the text box on the summary for that option would be blank.  I'd rather not have the blank areas...just a clean list of the selected options.  Or am I misunderstanding your post?

             

            Or...is there a way to concatenate the selections-only into a list in one large text field to create the summary?  Some kind of loop maybe? 

             

            Thanks!

            • 3. Re: PDF Form Summary
              try67 MVP & Adobe Community Professional

              You can use a single text field and write a more complex calculation script

              that will append all of the values from the different fields in the file

              into a single piece of text. Be aware, though, that the default value of a

              check-box or radio-button when it's not selected is not a blank string but

              "Off".

              • 4. Re: PDF Form Summary
                leahcar8 Level 1

                Ok... can you give me an example of what that script might look like?  I'm not a master programmer by any means, but if I could see what you're talking about I could probably figure it out. 

                 

                Thanks!

                • 5. Re: PDF Form Summary
                  try67 MVP & Adobe Community Professional

                  Here's a generic example (this will populate a multi-line text field):

                  var v1 = this.getField("Text1").value;

                  var v2 = this.getField("Text2").value;

                  var v3 = this.getField("Radio1").value;

                  var v4 = this.getField("CheckBox1").value;

                   

                  var v = "";

                  if (v1!="") v+= "Value1 is: " + v1 + "\r";

                  if (v2!="") v+= "Value2 is: " + v2 + "\r";

                  if (v3!="Off") v+= "Value3 is: " + v3 + "\r";

                  if (v3!="Off") v+= "Value4 is: " + v4 + "\r";

                   

                  event.value = v;

                  • 6. Re: PDF Form Summary
                    leahcar8 Level 1

                    Thanks! That makes sense.  My only other question is regarding the radio buttons.  Your example for "Radio1" is referring to the radio group name, right?  ...and not an individual radio button?

                    • 7. Re: PDF Form Summary
                      try67 MVP & Adobe Community Professional

                      That's right, you can only access the entire group...

                      • 8. Re: PDF Form Summary
                        leahcar8 Level 1

                        Great!  Thanks again for your help. 

                        • 9. Re: PDF Form Summary
                          leahcar8 Level 1

                          Everything is working great and rendering fine except for the radio groups.  I think I have something backwards...in a group of three, it will show the two that are not selected rather the one that is selected.

                           

                          Here's an example of what I have for a radio group...

                           

                          var hf = this.getField("HF").value;

                          var v = "";

                           

                          if (hf!="HF.Option 1") v+= "- Option 1" + "\r";

                          if (hf!="HF.Option 2") v+= "- Option 2" + "\r";

                          if (hf!="HF.Option 3") v+= "- Option 3" + "\r";

                           

                          event.value = v;

                           

                          HF is the name of the radio group with Option 1, Option 2, and Option 3 being the assigned Radio Button Choices.  I've tried it as shown as well as without the HF in front of the options.

                           

                          Any suggestions?

                          • 10. Re: PDF Form Summary
                            try67 MVP & Adobe Community Professional

                            If the values are Option 1, Option 2, etc., why are you check if they are

                            "HF.Option 1", "HF.Option 2", etc.? In other words, drop the "HF.". Also, I

                            think your logic is backwards... The != operator means "does not equal". If

                            you want to check it if it is equal, use == instead of != .

                            • 11. Re: PDF Form Summary
                              leahcar8 Level 1

                              ==  Thanks...  I knew it had to be something stupid.  I realize the != is "does not equal", but when I took it out originally, I forgot to put the other = in  ...and of course it didn't work, so I had just put it back in to try something else.  And yes...I did try it without the HF in front...  and I thought that's how it should be, but like I said, it didn't work so I was just trying different things.  Just dumb newbie mistakes. 

                               

                              Thanks again...