automatically check that the name of checkbox not repeated

Community Beginner ,
Jun 07, 2018 Jun 07, 2018

Copy link to clipboard

Copied

I have an interactive forms document. contains almost 200 elements: checkboxes and text field. it takes a lot of time to check the check boxes - if the names are not repeated (then when selecting one, two are marked). Is it possible to write an automatic test or script that will check if the names are not repeated? and how to write such a test? in what? where are I writing?

TOPICS
Acrobat SDK and JavaScript

Views

70

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 28, 2020 Feb 28, 2020

Copy link to clipboard

Copied

LATEST

HI,

 

[I know this is old, but I was sure there was a solution, in case it can help]

 

The script works by checking all the checkboxes using checkThisBox method which allows us to only check single boxes and uncheck any that have multiple entries.

 

var numFields = this.numField; // get all fields in the document

for ( var i = 0; i < numFields; i++) {
    var curField = this.getField(this.getNthFieldName(i)); // get each field in turn
    if (curField.type == "checkbox"){ // if it is a checkbox
        for ( var j = 0; j < 2; j++){
            curField.checkThisBox ( j, j == 0); // if first instance check it, else uncheck it.
        }
    }
}

 

This means that after this script is run any checkbox that is unchecked has a duplicate field.

 

Regards

 

Malcolm

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines