Copy link to clipboard
Copied
I have designed an Interactive PDF Form in which the user is required to check 4 boxes eg A,B,C,D. If the user fails to check any of the 4 boxes, comments section has to be come a required field. This will require a Javascript I assume, which i don't know. Please help
Copy link to clipboard
Copied
As the custom calculation script of the comments field enter the following code:
var a = this.getField("A").valueAsString=="Off";
var b = this.getField("B").valueAsString=="Off";
var c = this.getField("C").valueAsString=="Off";
var d = this.getField("D").valueAsString=="Off";
event.target.required = (a || b || c || d);
Copy link to clipboard
Copied
Use this code as the custom calculation script of your field:
var a = this.getField("group 1").valueAsString=="No";
var b = this.getField("group 2").valueAsString=="No";
var c = this.getField("group 3").valueAsString=="No";
if (a && b && c) event.value = "Thank you...";
else event.value = "Sorry...";
Copy link to clipboard
Copied
Let me move this to the Acrobat forum for you, where you are more likely to receive an answer to your question.
The Community Help forum is for help in using the Adobe Support Community forums, not for help with specific programs. Product questions should be posted in the associated product community.
Copy link to clipboard
Copied
As the custom calculation script of the comments field enter the following code:
var a = this.getField("A").valueAsString=="Off";
var b = this.getField("B").valueAsString=="Off";
var c = this.getField("C").valueAsString=="Off";
var d = this.getField("D").valueAsString=="Off";
event.target.required = (a || b || c || d);
Copy link to clipboard
Copied
You are super awesome. My heartiest thanks to you. The code worked like a charm!! Million thanks
Copy link to clipboard
Copied
Please help me with one more thing:
I have 3 questions with Yes/No choice. I have created group 1, group 2 and group 3. If the answer for all the 3 is No then i have to display a message " Thank you ......" and if any one is Yes then the display message will be "Sorry ...". How do we display these messages? Thanks in advance!
Copy link to clipboard
Copied
Use this code as the custom calculation script of your field:
var a = this.getField("group 1").valueAsString=="No";
var b = this.getField("group 2").valueAsString=="No";
var c = this.getField("group 3").valueAsString=="No";
if (a && b && c) event.value = "Thank you...";
else event.value = "Sorry...";
Copy link to clipboard
Copied
Thanks for your prompt response. I have only text and choice boxes on the form. Where do I insert the script?
Copy link to clipboard
Copied
As the custom Calculation script of your text field.
Copy link to clipboard
Copied
I inserted a new text field inthe form and added the script to Custom Calculation script but after i select the choices for the groups it does not display the message in the text box. What am i missing? I have made it a read only field. Is it possible to display the message in this text box?
Is it possible that I create 2 test fields and based on the condition above hide/unhide them?
Copy link to clipboard
Copied
Hard to say without seeing the file, but the first step should be to check the JS Console (Ctrl+J) for error messages.
Copy link to clipboard
Copied
Is it possible that I create 2 text fields and based on the condition above hide/unhide them?
Copy link to clipboard
Copied
Yes, but it's not needed.
Copy link to clipboard
Copied
My guess is one of the names of the fields is incorrect, or their export values.
Copy link to clipboard
Copied
I shared the file on https://drive.google.com/file/d/114_VTJJL3NTP25S8vdz4ZSW-O11N_NIl/view?usp=sharing
Copy link to clipboard
Copied
Did you check the JS Console, as I've suggested? The problem will be very clear if you do.
Copy link to clipboard
Copied
Thanks. It worked, saw the error on the console, fixed it. May thanks again!!
Copy link to clipboard
Copied
I would like a text box where numbers are entered and if a certain number is entered, a specific hidden Template will populate. Can you please help me with the coding? This is what I have so far, but it will only populate the last template. The first two aren't populating no matter what number I enter.
var a = this.getField("Signing1-9").valueAsString=="1";
var b = this.getField("Signing1-9").valueAsString=="2";
var c = this.getField("Signing1-9").valueAsString=="3";
var d = this.getField("Signing1-9").valueAsString=="4";
var e = this.getField("Signing1-9").valueAsString=="5";
var f = this.getField("Signing1-9").valueAsString=="6";
var g = this.getField("Signing1-9").valueAsString=="7";
var h = this.getField("Signing1-9").valueAsString=="8";
var i = this.getField("Signing1-9").valueAsString=="9";
if(a && b && c)event.value=this.getTemplateAsString("Regulatory").hidden=false;this.getTemplateAsString("Signing1-3").hidden=false;
if(d && e && f)event.value=this.getTemplate("Signing4-6").hidden=false;
else event.value=this.getTemplate("7-9").hidden=false;

