AutoFill checkbox from a drop - down - list

Community Beginner ,
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);
}

 

 

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

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);
}
TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to

Views

154

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

AutoFill checkbox from a drop - down - list

Community Beginner ,
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);
}

 

 

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

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);
}
TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to

Views

155

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
Dec 23, 2019 0
Adobe Community Professional ,
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
Reply
Loading...
Dec 23, 2019 0
Community Beginner ,
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
Reply
Loading...
Dec 23, 2019 0
Adobe Community Professional ,
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
Reply
Loading...
Dec 23, 2019 1
F. Graf LATEST
Community Beginner ,
Dec 23, 2019

Copy link to clipboard

Copied

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
Reply
Loading...
Dec 23, 2019 0