Copy link to clipboard
Copied
I need to fill a textbox with a date depending on the selection from a dropdown list on the form. How do I do this? I'm not having much luck getting this thing figured out. Any help would be greatly appreciated.
Here's what I have now that isn't working. I'll also have an else if statement to compare the other selected items.
The Dropdownlist field is called Grant Number and the Textbox is labeled Text4
The different values for the grant dropdown list are TR15-100, TR16-100 or TR17-100
var e= document.getElementById("Tracking Group").text;
var f= document.getElementById("Text4");
if (e="TR15-100"){
f.text = "9/1/2015-3/31/2017";
}
Copy link to clipboard
Copied
OK. In that case you can use this code as the custom calculation script of Text4:
var e = this.getField("Tracking Group").valueAsString;
if (e=="TR15-100"){
event.value = "9/1/2015-3/31/2017";
} else event.value = "";
Copy link to clipboard
Copied
Are you talking about a PDF form or a web-page?
Copy link to clipboard
Copied
This is a pdf form
Copy link to clipboard
Copied
OK. In that case you can use this code as the custom calculation script of Text4:
var e = this.getField("Tracking Group").valueAsString;
if (e=="TR15-100"){
event.value = "9/1/2015-3/31/2017";
} else event.value = "";
Copy link to clipboard
Copied
That worked great. Thank you. Try67 greatly appreciated.
Copy link to clipboard
Copied
Your JavaScript code is for web pages.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more