Copy link to clipboard
Copied
I have 2 radio buttons i'm looking to determine other text boxes in my pdf.
If Group1 - Choice1 is selected I want to be able to populate N/A in the boxes and make them read only. If Group1 - Choice2 I want to make those fields (that would be read only with Choice 1) blank and fillable. Hopefully this makes sense.
Copy link to clipboard
Copied
What about if neither option is selected?
Copy link to clipboard
Copied
Well for this document, one is going to have to be selected. It is for Auditing purposes, so if neither is selected the whole document is 100% wrong. It is also the first selection on the pdf file and the rest of the boxes will generate off the first selection.
Copy link to clipboard
Copied
OK. You can use something like this as the MouseUp event of the radio-button fields, then:
var f = this.getField("Text1");
var v = event.target.value;
if (v=="Choice1") {
f.value = "N/A";
f.readonly = true;
} else {
f.value = "";
f.readonly = false;
}
Copy link to clipboard
Copied
Thank you! I ended up having to change it a bit and run it in custom calculation script. This was my final that worked!
var f = this.getField("Text1");
var v = this.getField("Group1").value; if (v=="Choice1") {
f.value = "N/A";
f.readonly = true;
} else {
f.value = "";
f.readonly = false;
}
Copy link to clipboard
Copied
This will overwrite any value you enter into the text field, though.
Copy link to clipboard
Copied
Okay so It needs to go in the mouse up? The code you gave me wasn't populating anything at all. I made some tweaks and got it to at least populate.
Copy link to clipboard
Copied
Is the text field actually called "Text1"? If not, you'll need to adjust the code, of course.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now