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?
Copy link to clipboard
Copied
When comparing use double ==, "ChkFee").value == "Off"
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}}
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?
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.
Copy link to clipboard
Copied
I see now! I misnamed the field! It works. Thank you!!