Skip to main content
Participating Frequently
February 27, 2024
Question

Adobe PDF prohibit unchecking of check box

  • February 27, 2024
  • 1 reply
  • 1255 views

I have an Interactive PDF form. On this form I have a small group (7 options)of checkboxes. 2 of the boxes are directly associated with each other (one way relationship)

These 2 checkboxes are Network and Infrastructure (dependent upon Network).

The scenarion is the following:

  • If Network is checked then Infrastructure needs to be checked as well. (This part is complete)
  • If user tries to unchecked Infrastructure, then they will not be able to unchecked it without first unchecking Network, but I want to explain to them why, think alert or something. ( this i am having problems with)
  • Infrastructure can be toggled on/off any other time Network is not checked. Got this covered)

 

I currently am using the following script on Mouse Up:

 Var f = this.getField("cr_infrastructure");

If (event.target.isBoxChecked(0,true))

{ f.checkThisBox(0,true);}

Else

{f.checkThisBox(0,false);}

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
February 27, 2024

That script will not work, it should be 'var', 'else', 'if' not 'Var', 'Else', 'If' it's case sensitive.

To do what you want, you will need to have custom calculation script placed in any text field.

What is the exact name of Network checkbox?

MContriAuthor
Participating Frequently
February 27, 2024

Nit sure what you mean by not gonna work. I have the order just like you stated and Actually the script does work for checking and unchecking the Infrastructure check box when the Network check box is clicked and unclicked. 

I have never done a calculated script before and the name of the Network checkbox is cr_Network.

try67
Community Expert
Community Expert
February 27, 2024

The issue is not the order but the spelling. It's "var" not "Var", "if" not "If", etc. Your code as you posted it will produce multiple error messages. I assume that's not really your code, or it wouldn't work at all. It was probably modified when you copied it to something like Word before posting it here.