Copy link to clipboard
Copied
How do I get a field to average if another field’s display is visible and hide it if the display is hidden? It doesn’t seem like I can have it both ways. If “Laborer/Sampler” is selected from a drop-down list, “knowledge of product”, “Cooperation”, “Attitude”, “Judgement” and “Tact” are hidden. “Grade” is an average of the afore mentioned fields and is also a “read only” field. It will not “hide” when “Laborer/Sampler” is selected. Any help would be greatly appreciated., Thanks!
Copy link to clipboard
Copied
Please post the exact name of the Adobe program you use so a Moderator may move this message to that forum
.
When you ask a question you always need to provide some basic information
-Forum quick start https://community.adobe.com/t5/Community-Help/ASK-Forum-Success-Guide-Efficiently-using-the-forums/t...
-https://community.adobe.com/t5/Get-Started/Questions-you-need-to-answer-to-receive-better-help/td-p/...
-https://community.adobe.com/t5/get-started/how-to-post-and-get-your-issue-resolved-or-what-do-you-ne...
Copy link to clipboard
Copied
What kind of form is this?
Are you building it in Dreamweaver, InDesign or something else?
Copy link to clipboard
Copied
I'm just creating a form Adobe DC, trying to use a "Custom Calculation Script"
Copy link to clipboard
Copied
Oh, you mean Adobe Acrobat Pro DC.
Copy link to clipboard
Copied
As the custom validation script of the Position field you can enter something like this:
this.getField("Grade").display = (event.value=="Laborer/Sampler") ? display.hidden : display.visible;
Copy link to clipboard
Copied
I found a script that works perfectly. Thank you for your help!
var fields = [ "Knowledge of Product", "Cooperation", "Attitude", "Judgement", "Tact" ];
var cnt = 0;
var total = 0;
for (var i in fields) {
var f = this.getField(fields[i]);
if (f.valueAsString != "") {
cnt++;
total = total + Number(f.value);
}
}
event.value = total/cnt;
if (this.getField("Position").value == "Inspector"){
event.target.display = display.visible;
}
else{
event.target.display = display.hidden;
}
Copy link to clipboard
Copied
You'll need to extend the code provided by Try67 to include not only the fields, but also the text. To do this the text needs to be removed from the PDF and replaced with Read Only Text fields.
Copy link to clipboard
Copied
Thank you for your help, I found a script that works (see above).
Copy link to clipboard
Copied
If you just want to hide /show fields depending on dropdown selection, use this code as "Validation" script of dropdown field:
if(event.value == "Laborer/Sampler"){
this.getField("knowledge of product").display = display.visible;
this.getField("Cooperation").display = display.visible;
this.getField("Attitude").display = display.visible;
this.getField("Judgement").display = display.visible;
this.getField("Tact").display = display.visible;
this.getField("Grade").display = display.visible;}
else{
this.getField("knowledge of product").display = display.hidden;
this.getField("Cooperation").display = display.hidden;
this.getField("Attitude").display = display.hidden;
this.getField("Judgement").display = display.hidden;
this.getField("Tact").display = display.hidden;
this.getField("Grade").display = display.hidden;}
Copy link to clipboard
Copied
Thank you! I found a script that works (see above).