1 Reply Latest reply on Feb 3, 2014 8:46 AM by BSisson

    Can I test for a field without generating an error?

    BSisson Level 1

      I am building a large and complex form.

      To keep llife simple, I am using loops to go through all of the fields and sections. 

      I know when the sections end as the LAST field has a Export value of "MAX" and is hidden.

      So my basic loops work fine...


      BUT... each section can have some extra associated fields randomly associated.


      I am looking for a way to FIND those fields inside the loops but if I test for them with "GetField(" and they DON'T exist, it will throw a JS error.


      I am looking for a way to flag checkbox fields with an atribute I can scan for that isn't visible,


      I will have -LOTS- of fields  (Hundreds)


      there are named "Button.Section.ButtonNo"  (Button.2.12 is the 12th button in section #2)


      The Detail fields "Button.Section.ButtonNoDetail)


      This allows a JS to run on the buttons that -DO- have detail to make the detail field REQUIRED and stroke it in RED


      The GOAL is to when looping through the Buttons, to check the ones that are checked to see if they have an associated required field, and then check to make sure it is filled in similar to the script in "Required fields Adobe XI forms"


      This way when people use the Script to "Build Summary" part of it will pop up an allert "Please fill in these fields (list)


      I am still working on my TINY version of the form as a "Proof_of_Concept"




      Not all fields do anything.  But select red fields and then hit "Build Summary"  and see what happens 

      (the red strokes will not be there in the final version, they are there to highlight the current special fields)


      My question is how to detect fields like "Sump Pump Location"   (button.2.2 & button.2.2detail)


      So far I have tested this on a PC, an Android 10" Tablet and a iPad using ADOBE READER on each platform.


      Again the shared document is just a "Proof of Concept" test bed.

        • 1. Re: Can I test for a field without generating an error?
          BSisson Level 1

          Found it.

          I am learning why the refernce for JavaScript is 745 some odd pages.


          There are system functions for Number of total Fields (numFields)

                                                            Name of any particular field    (getNthfieldName)



          You can then use a loop to find the field that are marked as REQUIRED and that are EMPTY.


          Works GREAT inside my "Build Summary" button.