Print Page | Close Window

Checkboxes become both checked and disabled

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: PDF Forms and FDF
Forum Description: This conference is for users of PDF Forms, JavaScript and FDF Toolkits.
URL: http://forums.planetpdf.com/forum_posts.asp?TID=3951
Printed Date: 07 Dec 2019 at 12:08am
Software Version: Web Wiz Forums 11.10 - http://www.webwizforums.com


Topic: Checkboxes become both checked and disabled
Posted By: SweDentan
Subject: Checkboxes become both checked and disabled
Date Posted: 07 Feb 2018 at 2:27pm

Hi,

 

I have three checkboxes in my pdf-form (using Adobe Acrobat Pro DC) named checkbox1, checkbox2 and checkbox3.

 

I wish the following to happen:

 

If checkbox1 is checked, then:

• checkbox2 and checkbox3 also becomes checked

• but at the same time checkbox 2 and checkbox3 also become disabled (by disabled

I mean not checkable, not clickable).

 

I have this script that does half the job, it disables checkbox 2 and checkbox3 when checkbox1 is checked:

 

// set readonly property based on the value of this field compared to "Off";

this.getField("checkbox2").readonly = (event.target.value != "Off");

this.getField("checkbox3").readonly = (event.target.value != "Off");

 

Though, as described above, I want checkbox2 and checkbox3 to become both checked and disabled at the same time.

 

How would this script look like?

 

Thanks for your help!

 

Greatings,

Dennis (Javascript beginner)




Replies:
Posted By: Merlin
Date Posted: 14 Feb 2018 at 8:35am
Hi.

Select checkboxes one by one : go to Properties : Option : and set a different "Export value" for each checkbox.


-------------
ENG : https://www.abracadabrapdf.net/utilities-in-english/welcome/ - abracadabraPDF.net
FRA : https://www.abracadabrapdf.net - abracadabraPDF.net


Posted By: kevindebenu
Date Posted: 06 Mar 2018 at 8:33am
It's possible to do this using the "checkThisBox" method, here's an example:

var checkbox1 = this.getField("checkbox1")
var checkbox2 = this.getField("checkbox2")
var checkbox3 = this.getField("checkbox3")

checkbox1checked = (checkbox1.value != "Off")

checkbox2.checkThisBox(0, checkbox1checked)
checkbox2.readonly = checkbox1checked
checkbox3.checkThisBox(0, checkbox1checked)
checkbox3.readonly = checkbox1checked




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 - http://www.webwizforums.com
Copyright ©2001-2017 Web Wiz Ltd. - https://www.webwiz.net