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.


Uncheck a checkbox and tturn field to zeo

Community Beginner ,
Jul 30, 2021 Jul 30, 2021

Copy link to clipboard

Copied

I have run this script for a dollar value field

{if (this.getField("ChkFee").value = "Off") {
event.value = 0}}

I am trying to get a checkbox to return a value of 0 to a calculated field (using javascript) when the checkbox is unchecked (off).  I want to fill in that field with 0 if there is no check there.  This does not seem to do that.  Does anyone know the problem with the code?

TOPICS
JavaScript, PDF forms

Views

42

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 ,
Jul 30, 2021 Jul 30, 2021

Copy link to clipboard

Copied

When comparing use double ==,    "ChkFee").value == "Off"

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 ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

Thank you for your response.  I still cannot get it to insert a zero into that field after i made the correction to two ='s.  Checking the box seems to have no effect.  I have this in the custom calculation field.

 

{if (this.getField("ChkFee").value == "Off") {
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
Adobe Community Professional ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

Make sure checkbox name is same as in script.

Do you have any other calculations that could affect that field?

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 ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

The checkbox name is in the script.  No other calculations.  I also tried this as well:

{if (this.getField("ChkFee").value == "Off") {
this.getField("amtComp").value = 0}}

that does not work either.  Does calculation order have anything to do with this.  I just don't know enough to write the proper code.

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 ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

LATEST

I see now!  I misnamed the field!  It works. Thank you!!

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