Skip to main content
JR Boulay
Community Expert
Community Expert
September 15, 2021
Answered

Synchronize two groups of checkboxes

  • September 15, 2021
  • 3 replies
  • 519 views

Hi Experts

 

I have 2 groups of 4 checkboxes, using different names and using different export values.

So I need to synchronize the 2 sets using the nWidget number of the ticked checkbox (I carefully created them in the same order).

I know how to tick a checkbox using checkThisBox but I don't know how to get the nWidget number of the ticked checkbox.

 

Here my not working script:

var nIndx = this.getField(event.target.name).nWidget;
console.println(nIndx);
this.getField("targetCheckbox").checkThisBox(nIndx, true);

 

But the var nIndx stays "undefined".

 

Thank you

This topic has been closed for replies.
Correct answer try67

You can get the index number of the selected box in a group like this:

 

var f = event.target;
var nIndx = f.exportValues.indexOf(f.valueAsString);

 

If no box is selected nIndx will equal -1.

3 replies

JR Boulay
Community Expert
JR BoulayCommunity ExpertAuthor
Community Expert
September 16, 2021

Thank you very much.

 

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
September 16, 2021

You can get the index number of the selected box in a group like this:

 

var f = event.target;
var nIndx = f.exportValues.indexOf(f.valueAsString);

 

If no box is selected nIndx will equal -1.

JR Boulay
Community Expert
JR BoulayCommunity ExpertAuthor
Community Expert
September 16, 2021

up!

Acrobate du PDF, InDesigner et Photoshopographe