Search code examples
javascriptacrobat

Acrobat DC Two Check boxes on or the other must be checked


I have two checkboxes one named OPEN the other named WOMEN. I would like to require that one or the other has to be checked. If one isn't checked then both boxes would show as required. As soon as you check a box the other requirement goes away.


Solution

  • I was able to accomplish this by doing the following.

    On "OPEN" Button

    if (this.getField("OPEN").value != "Yes") {
    this.getField("WOMEN").required = true ;
    this.getField("OPEN").required = true ;
    } else {
    this.getField("WOMEN").required = false ;
    this.getField("WOMEN").value="Off";
    }
    

    On "WOMEN" Button

    if (this.getField("WOMEN").value != "Yes") {
    this.getField("OPEN").required = true ;
    this.getField("WOMEN").required = true ;
    } else {
    this.getField("OPEN").required = false ;
    this.getField("OPEN").value="Off";
    }