Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


How can I add value to text box with multiple checkbox's "checked"?

New Here ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

I have 3 different check boxes and 1 Text Field. 

I am trying to get the Text Field value to stay at 0 when none of the boxes are checked. When the checkbox "CB1" is checked I'd like the value to be 169. When checkbox "CB5" is checked I'd like the value to be 399. When "CB3" is checked I'd like the value to be 1099. Any idea how to do this? I am new to scripting! 

TOPICS
How to

Views

587

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

Adobe Community Professional , May 27, 2021 May 27, 2021
Try this: if(this.getField("CB3").valueAsString != "Off" && this.getField("CB1").valueAsString != "Off" && this.getField("CB5").valueAsString != "Off") event.value = 1099; else if(this.getField("CB1").valueAsString != "Off" && this.getField("CB5").valueAsString != "Off") event.value = 399; else if(this.getField("CB1").valueAsString != "Off") event.value = 169; else event.value = 0;

Likes

Translate

Translate
Adobe Community Professional ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

[Moderator moved from Using the Community (forums) to Acrobat.]

 

Nancy O'Shea, Adobe Product User & Community Professional
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

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
Adobe Community Professional ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

As caclulation script of "Text Field" use this:

if(this.getField("CB1").valueAsString != "Off")
event.value = 169;
else if(this.getField("CB3").valueAsString != "Off")
event.value = 1099;
else if(this.getField("CB5").valueAsString != "Off")
event.value = 399;
else event.value = 0;

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
New Here ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

Thank you for your response. This script leaves the Text Field Value at 399. I need the value to change when different check boxes are marked! 

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
Enthusiast ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

How do you use checkboxes, only one is checked or all 3 are checked, can you describe process?

 

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
New Here ,
May 27, 2021 May 27, 2021

Copy link to clipboard

Copied

I am using the checkboxes to add on features. If the are getting a base model then CB1 gets checked & value would be 169. If they are getting a mid-grade model then CB1 & CB5 get checked & value is 399. If they want a high end model CB 1, CB5 & CB3 all get checked & value is 1099. 

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
Adobe Community Professional ,
May 27, 2021 May 27, 2021

Copy link to clipboard

Copied

Try this:

if(this.getField("CB3").valueAsString != "Off" && this.getField("CB1").valueAsString != "Off" && this.getField("CB5").valueAsString != "Off")
event.value = 1099;
else if(this.getField("CB1").valueAsString != "Off" && this.getField("CB5").valueAsString != "Off")
event.value = 399;
else if(this.getField("CB1").valueAsString != "Off")
event.value = 169;
else event.value = 0;

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
New Here ,
May 27, 2021 May 27, 2021

Copy link to clipboard

Copied

LATEST

Thank you so much! This worked perfectly. 

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