Skip navigation
nypumrider
Currently Being Moderated

Counting empty text fields

Apr 25, 2012 8:25 AM

Tags: #acrobat_x_pro #acrobat-forms #acrobat_10_pro

Hi. I'm looking for a way to count empty text fields in a pdf form and to have the result automatically entered in another field on the same form. Thanks in advance for your help.

 
Replies
  • George Johnson
    11,671 posts
    Aug 11, 2002
    Currently Being Moderated
    Apr 25, 2012 9:21 AM   in reply to nypumrider

    What type of fields do you want to check, exactly? Checking for an unchecked check box or radio button is done differently than checking for a blank text field, which is different than an apparently blank combobox/dropdown.

     
    |
    Mark as:
  • George Johnson
    11,671 posts
    Aug 11, 2002
    Currently Being Moderated
    Apr 25, 2012 10:57 AM   in reply to nypumrider

    OK, here's a simple custom calculate script for a text field that displays the number of blank text fields that are named "num.1" - "num.10":

     

    // Custom Calculate script
    (function () {
    
        // Initialize sum of blank fields
        var sum = 0;
    
        // Count how many fields are blank
        for (var i = 1; i < 11; i += 1) {
            if (!getField("num." + i).valueAsString) sum += 1;
        }
    
        // Set this field value to the sum
        event.value = sum;
    
    })();
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points