How to Hide Text in PDF Based on Combo Box Selection
Hi Team,
I'm working on an interactive PDF form in Adobe Acrobat, and I have a combo box field named "Health_Plan." I want to hide a specific text element ("Sepatha® is available on:") when the user selects a visually blank list item in the combo box.
I found the below script in one reference file which is working same as my requiremnt.
I've tried using the JavaScript code below in the JavaScript Console of my document but its not working:
// -------------------------------------------------------------
// ----------------- Do not edit the XML tags -----------------
// -------------------------------------------------------------
// <AcroForm>
// <ACRO_source>Health_Plan:Validate</ACRO_source>
// <ACRO_script>
/*********** belongs to: AcroForm:Health_Plan:Validate ***********/
var layers = this.getOCGs();
var v = event.value;
for (var i = 0; i < layers.length; i++) {
if (layers[i].name === "Repatha_Is_Available_On") {
if (v === "") {
layers[i].state = false;
} else {
layers[i].state = true;
}
}
}
// </ACRO_script>
// </AcroForm>
However, I'm not sure if this is the correct approach or if there's a better way to achieve this behavior. Could someone please provide guidance on how to dynamically hide a specific text element based on the selection made in a combo box?
Any help or suggestions would be greatly appreciated. Thank you!
