Copy link to clipboard
Copied
What am I doing wrong; the field with the following javascript is not showing the result?
var z = this.getField("total5c").value;
if (z >= 0) {
event.value = getField("total6c").value / z;
} else {
event.value = 0;
}
Copy link to clipboard
Copied
Are you getting any errors on the JavaScript console (use Ctrl-J or Cmd-J to display it)? If not, are you sure you are using the script as a custom calculation script?
Copy link to clipboard
Copied
I'm using the Actions JavaScript. I opened the javaScript Debugger and it shows the following invalidseterror or unknown not sure what the all means
Copy link to clipboard
Copied
JavaScript Debugger shows but I'm not sure what to to or look for? I based the script from examples. I'm totally new to javascript and only mangle to get copy and paste examples to get my fields to process the code. Using the Calculate works on the simplified field notation but I want if statement. not sure what to do. The script is in the Actions tab not Calculat tab.
Copy link to clipboard
Copied
Is this for a button action? A button does not have an event.value property. If you want to calculate a field, you would use the field's calculation tab and then select the "custom calculation script" option. If this does not help, can you share your PDF file?
Copy link to clipboard
Copied
Also you really don't want to divide by z if z is zero. Consider what you want to show in this case.
Copy link to clipboard
Copied
By the way if you get errors and don't understand them please copy and paste the entire script and entire console into the same message for people to take a look at. Don't summarize!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now