• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
13

Adobe PDF prohibit unchecking of check box

Community Beginner ,
Feb 26, 2024 Feb 26, 2024

Copy link to clipboard

Copied

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);}

TOPICS
Create PDFs , Edit and convert PDFs , PDF , PDF forms

Views

222

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
Community Expert ,
Feb 26, 2024 Feb 26, 2024

Copy link to clipboard

Copied

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?

Votes

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
Community Beginner ,
Feb 26, 2024 Feb 26, 2024

Copy link to clipboard

Copied

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.

Votes

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
Community Expert ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

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.

Votes

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
Community Beginner ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

Oh I understand what you are getting at. You are correct that isn't my exact code. I typed it using my phone. The code I have is in correct lowercase

Votes

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
Community Expert ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

If you have in your script 'var', else', 'if' it will work but script you posted will not work.

Use this as 'Mouse UP' action of "cr_infrastructure" checkbox:

var net = this.getField("cr_Network");
if(net.isBoxChecked(0)){
app.alert("Please uncheck Network checkbox first.",3);
event.target.checkThisBox(0);}

Votes

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
Community Beginner ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

Ok i will give that a go and let you know. Thank you very much. 

Votes

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
Community Beginner ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

LATEST

That worked perfectly thank you

Votes

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