Copy link to clipboard
Copied
I'm trying to do something that should be simple, but it's not working.
FIRST
I think I have the right code, but not sure:
var frequency = this.getField("1_Year").value;
if (frequency == "Off") {
Amount.value = "100";
}
else if (frequency == "On") {
Amount.value = "200";
}
Would this output "100" into field "Amount" for off and "200" for on?
SEDCONDLY:
when I type this into a custom calculation field and hit ok, acrobat closes the window as if it's accepted it, but when I look at the box, it has gone back to "value is not calculated", which is obviously not what I want.
Any help?
Copy link to clipboard
Copied
Well, I think I figured it out, but I can't edit or delete this post so. oh well?
Copy link to clipboard
Copied
Here's an article that covers the basics of scripting radio buttons:
https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm
Basically, the default "On" value for a radio button is "Yes". But this is also the export value, which you can change to be whatever you want.
Copy link to clipboard
Copied
Thanks Thom, I do understand that, but my arger issue is part two. I'm writing what I think is correct code, but it's just dissappearing once I type it in. Any help there?
Copy link to clipboard
Copied
Yeah, dissappearing calculation scripts is a big problem. This happens when Acrobat is confused about the selected calculation type, which happens when switching between fields. I haven't had this problem in a while because I'm very careful not to click on stuff too fast in any dialog in Acrobat. However, I understand that this issue can also happen with the built-in editor, which doesn't work that great. I would suggest setting up Acrobat with an external editor, such as Notepad++, which besides being an awesome code editor, is free.
I don't know if this will fix your issue, only Adobe can know that. But it's worked for me.
Copy link to clipboard
Copied
Thanks. So far nothing is working for me - I can't even get it to save the fields I pick for simple value calculations so... it's clearly something program based. Ugh.