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

AutoFill checkbox from a drop - down - list

Community Beginner ,
Dec 23, 2019 Dec 23, 2019

Copy link to clipboard

Copied

Hi,

I have a problem. I wrote  this java - script to autofill diffrent checkboxes from a selection in a Drop - Down - List, but it doesnt work. Can somebody help me pls? Thanks for helping!

 

if (event.value == "Modul Ernährung und Gewichtsreduktion") {
this.getField("Check 0").checkThisBox(0,true);
this.getField("Check 4").checkThisBox(0,true);
this.getField("Check 5").checkThisBox(0,true);
this.getField("Check 7").checkThisBox(0,true);
this.getField("Check 15").checkThisBox(0,true);
}
else {
this.getField("Check 0").checkThisBox(0,fals);
this.getField("Check 4").checkThisBox(0,fals);
this.getField("Check 5").checkThisBox(0,fals);
this.getField("Check 7").checkThisBox(0,fals);
this.getField("Check 15").checkThisBox(0,fals);
}

if (event.value == "Modul Bewegung") {
this.getField("Check 0").checkThisBox(0,true);
this.getField("Check 4").checkThisBox(0,true);
this.getField("Check 16").checkThisBox(0,true);
this.getField("Check 81").checkThisBox(0,true);
}
else {
this.getField("Check 0").checkThisBox(0,fals);
this.getField("Check 4").checkThisBox(0,fals);
this.getField("Check 16").checkThisBox(0,fals);
this.getField("Check 81").checkThisBox(0,fals);
}

if (event.value == "Modul entspanntes Leben") {
this.getField("Check 3").checkThisBox(0,true);
this.getField("Check 6").checkThisBox(0,true);
this.getField("Check 9").checkThisBox(0,true);
}
else {
this.getField("Check 3").checkThisBox(0,fals);
this.getField("Check 6").checkThisBox(0,fals);
this.getField("Check 9").checkThisBox(0,fals);
}

 

 

TOPICS
Acrobat SDK and JavaScript

Views

256

Likes

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

correct answers 1 Correct answer

Community Expert , Dec 23, 2019 Dec 23, 2019

The second if resets the checkbox.

 

Try this:

this.getField("Check 0").checkThisBox(0,false);
this.getField("Check 4").checkThisBox(0,false);
this.getField("Check 5").checkThisBox(0,false);
this.getField("Check 7").checkThisBox(0,false);
this.getField("Check 15").checkThisBox(0,false);
this.getField("Check 16").checkThisBox(0,false);
this.getField("Check 81").checkThisBox(0,false);
this.getField("Check 3").checkThisBox(0,false);
this.getField("Check 6").checkThisBox(0,false);
this.getField("Che
...

Likes

Translate

Translate
Community Expert ,
Dec 23, 2019 Dec 23, 2019

Copy link to clipboard

Copied

You must use false, not fals

Likes

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 ,
Dec 23, 2019 Dec 23, 2019

Copy link to clipboard

Copied

Hallo Bernd,

 

danke für deine Antwort. Weisst du warum ich beim Auswählen vom Modul Ernährung und Gewichtsreduktion kein Häckchen in der Checkbox 0 bekomme? Dies erscheint nur, wenn ich das zweite Modul auswähle? Kommt dass daher, dass sich hier einzelne Kästchen in den Modulen wiederholen?

 

Besten Dank für deine Antwort

HG

 

if (event.value == "Modul Ernährung und Gewichtsreduktion") {
this.getField("Check 0").checkThisBox(0,true);
this.getField("Check 4").checkThisBox(0,true);
this.getField("Check 5").checkThisBox(0,true);
this.getField("Check 7").checkThisBox(0,true);
this.getField("Check 15").checkThisBox(0,true);
}
else {
this.getField("Check 0").checkThisBox(0,false);
this.getField("Check 4").checkThisBox(0,false);
this.getField("Check 5").checkThisBox(0,false);
this.getField("Check 7").checkThisBox(0,false);
this.getField("Check 15").checkThisBox(0,false);
}

if (event.value == "Modul Bewegung") {
this.getField("Check 0").checkThisBox(0,true);
this.getField("Check 4").checkThisBox(0,true);
this.getField("Check 16").checkThisBox(0,true);
this.getField("Check 81").checkThisBox(0,true);
}
else {
this.getField("Check 0").checkThisBox(0,false);
this.getField("Check 4").checkThisBox(0,false);
this.getField("Check 16").checkThisBox(0,false);
this.getField("Check 81").checkThisBox(0,false);
}

if (event.value == "Modul entspanntes Leben") {
this.getField("Check 3").checkThisBox(0,true);
this.getField("Check 6").checkThisBox(0,true);
this.getField("Check 9").checkThisBox(0,true);
}
else {
this.getField("Check 3").checkThisBox(0,false);
this.getField("Check 6").checkThisBox(0,false);
this.getField("Check 9").checkThisBox(0,false);
}

Likes

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 ,
Dec 23, 2019 Dec 23, 2019

Copy link to clipboard

Copied

The second if resets the checkbox.

 

Try this:

this.getField("Check 0").checkThisBox(0,false);
this.getField("Check 4").checkThisBox(0,false);
this.getField("Check 5").checkThisBox(0,false);
this.getField("Check 7").checkThisBox(0,false);
this.getField("Check 15").checkThisBox(0,false);
this.getField("Check 16").checkThisBox(0,false);
this.getField("Check 81").checkThisBox(0,false);
this.getField("Check 3").checkThisBox(0,false);
this.getField("Check 6").checkThisBox(0,false);
this.getField("Check 9").checkThisBox(0,false);

if (event.value == "Modul Ernährung und Gewichtsreduktion") {
this.getField("Check 0").checkThisBox(0,true);
this.getField("Check 4").checkThisBox(0,true);
this.getField("Check 5").checkThisBox(0,true);
this.getField("Check 7").checkThisBox(0,true);
this.getField("Check 15").checkThisBox(0,true);
}

if (event.value == "Modul Bewegung") {
this.getField("Check 0").checkThisBox(0,true);
this.getField("Check 4").checkThisBox(0,true);
this.getField("Check 16").checkThisBox(0,true);
this.getField("Check 81").checkThisBox(0,true);
}

if (event.value == "Modul entspanntes Leben") {
this.getField("Check 3").checkThisBox(0,true);
this.getField("Check 6").checkThisBox(0,true);
this.getField("Check 9").checkThisBox(0,true);
}

Likes

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 ,
Dec 23, 2019 Dec 23, 2019

Copy link to clipboard

Copied

LATEST

It workes! Thank u verry much!!

Likes

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