I started a topic last week dealing with running calculation scripts on radio buttons that disapeer when a check box is unchecked:
http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=18562
These are the scripts that were offered to me by George_Johnson. From all outward appearences they seem to work.
Check box toggle action for radio buttons:
(function () {
// Get a reference to the radio button field
var f1 = getField("RadioButton4");
// Reset the radio button field
f1.value = f1.defaultValue;
// Show/Hide the radio buttons based on the state of this checkbox
f1.display = (event.target.value !== "Off") ? display.visible : display.hidden;
})();
Calculation script:
(function () {
// Get the text field values, as numbers
var v1 = +getField("Text5").value;
var v2 = +getField("Text6").value;
// Get the radio button value
var v3 = getField("RadioButton4").value;
// Set the value to zero if no radio buttons are selected
if (v3 === "Off") v3 = 0;
// Get the check box value
var v4 = getField("Checkbox4").value;
// Perform the calculation
if (v4 !== "Off") {
event.value = v1 + v2 + v3;
} else {
event.value = v1 + v2;
}
})();
This is the problem: I can only get the calculation script to work in preview. When Form Editing is closed and Saved with features extended to adobe reader, the file ONLY calculates the sum of Text5 & Text6, reguardless of the state of Checkbox4 or what button in RadioButton4 is selected, which of course renders the whole endeavor pointless. Furthermore, when I then reopen that file in Acrobat, and save a copy, and reopen Form Editing, from that point on the calculation does not work at all, even in preview. I have been screwing around with this problem for three days and am about at the end of my rope. Any help would be greatly appreciated.
Why would this only work in preview?
When I looked at that form, it behaved a bit oddly in Acrobat, and I suspect it got corrupted somehow. What you're describing is not normal and the code you're using is not the source of the problem, unless the field names are wrong. What I would do is start with a fresh PDF and copy & paste the fields and code. A bit of a nuisance, but that's all I can suggest. FWIW, your form is working fine on my system (Acrobat 9 Pro).George