Copy link to clipboard
Copied
I'm working on a fillable form in Adobe and need assistance with a dynamic text box. The text box should populate based on a dropdown selection, with a specific criteria that varies depending on a secondary dropdown selection. I'm having trouble developing the script to achieve this functionality and would appreciate any guidance or support.
Copy link to clipboard
Copied
Enter the following custom calculation script in the text field, changing the field names and values to the actual field names and values:
if(this.getField("Dropdown1").value=="valueA" && this.getField("Dropdown2").value=="valueB")
{event.value="valueC";}
else
{event.value="";}
Copy link to clipboard
Copied
Thank you. Just so I understand, I would put what I want valueC to be inside {event.value="";} correct?
Copy link to clipboard
Copied
No. That line gives the field no value if the conditions are not met. You would replace valueC with what you want the value to be.
Copy link to clipboard
Copied
Also I have one dropdown that says something seperate and after putting this in, neither will populate.
Copy link to clipboard
Copied
Check the Console for error messages. You probably entered some field name incorrectly.
Copy link to clipboard
Copied
I am new to writing script. This is what I have minus the suggestion from up top. Would using this format mess it up?
var f = this.getField("Text5");
if(event.value == "MPI")
f.value = "2. Leaders are responsible for issue and withdrawal of credentials are to report the name, SSN, DOB and credential number for individuals who have had credentials issued or withdrawn within 5 days of the issue or withdrawal. Please list date of withdrawal not the date of destruction. Withdrawal message must state the reason. Please list the date credential was issued if different from the date on the message.";
else if(event.value == "MWD")
f.value = "2. ***PLEASE NOTE*** this message is not to be given to the individual listed above. It is for official use only.";
else if(event.value == "PSD")
f.value = "2. The point of contact for this memorandum is below;
else if(event.value == "DACP")
f.value = "2. Your inquiry has been processed in accordance with AR 190-56 paragraph 2- 4(b), for employment security screening procedures.";
else if(event.value == "DASG")
f.value = "2. Your inquiry has been processed in accordance with AR 190-56 paragraph 2- 4(b), for employment security screening procedures.";
else if(event.value == "SAM")
f.value = "2. Your inquiry has been processed in accordance with AR 195-3 paragraph 2-6b(3), for employment security screening procedures.";
else if(event.value == "PCF")
f.value = "2. Your inquiry has been processed in accordance with AR 600-62 paragraph 3-1 (b), for initial processing into Personnel Control Facility.";
else
Copy link to clipboard
Copied
If the is set to the Date format then you can't apply any value to it that doesn't match that format, so yes, that code would cause an issue. Like I said, change its Format to None and try it again.
Copy link to clipboard
Copied
All the formats are set at none and still nothing. To me it seems like there is an issue because I have "MPI" specifing text despite what the Dropdown5 says.
Copy link to clipboard
Copied
What your response meant for this thread?
Copy link to clipboard
Copied
Your script has at least one error. Your are missing a closing quote after the "PSD" condition. Where is the script located (field, calculation/validation, etc.)?
Copy link to clipboard
Copied
I do have the closing quote but accidently deleted it will putting it on here. Everything is located under the validation for the "Billet#0" box
Copy link to clipboard
Copied
You need a line of code after the last word else. I put event.value=""; and it worked for me.