Copy link to clipboard
Copied
I worked on a Tool that can build PDF Forms. In this tool, I defined a DateTime field. I genereated an PDF Form which has a candenler that can allow user to choose the date. But the formatting is not what I wanted(see the image below). We wanted it shows MM/DD/YYYY
I posted formatting issue before which is about currency formating, the code is like this:
var Minisalary = this.getField("MiniSalary");
Minisalary.setAction("Format", "event.value = formatCurrency(event.value);");
So, I am wondering if we can do simialir code, like below to realize it, but I tried serval ways, it failed.
var date= this.getField("my field");
date.setAction("Format", "event.value = ???;");
Copy link to clipboard
Copied
Could you please help on the coding?
var Date= this.getField("StartDate");
Date.setAction("Format", "event.value = formatDate ("MM/DD/YYYY");");
I don't know what function should be used here.
Copy link to clipboard
Copied
What version of Adobe Acrobat does you use?
Copy link to clipboard
Copied
Adobo Pro DC
Copy link to clipboard
Copied
There you can use the format "MM/DD/YYYY" for the date field.
Copy link to clipboard
Copied
Could you please help on the coding?
var Date= this.getField("StartDate");
Date.setAction("Format", "event.value = formatDate ("MM/DD/YYYY");");
I don't know what function should be used here.
Copy link to clipboard
Copied
Sorry for confusion, please ingore the currency fomatting, the function formatDate is user-defined. Anyhow, the problem is fixed, and using below code:
//Date format MM/DD/YYYY, Business is a subtree, CurrentDate is a field under it. That needs a '_' between them.
var CurrentDate = this.getField("Business_CurrentDate");
var requiredFormat = "mm/dd/yyyy";
CurrentDate.setAction("Format", "AFDate_FormatEx(\""+requiredFormat+"\")");
CurrentDate.setAction("Keystroke", "AFDate_KeystrokeEx(\""+requiredFormat+"\")");