Feel silly here, but I can't seem to find a way to insert form fields that will display currnet time and date, I see where it can be done for a digital signature, but that's not what I need. This is for a client sign in sheet. I want to know what date and time the form is printed, without having to manually enter that data. Thanks.
If you want to set a field to show the date/time whenthe document is opened, you can use the following code in a document-level script:
getField("DATETIME").value = util.printd("mm/dd/yyyy HH:MM:ss"; new Date());
where "DATETIME" is the name of the field.
You can use the same code in the "Document Will Print" event to update it at the time of printing.
For more information on the date format string options, see: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_A croJS.88.1251.html
No, it should be placed either in a document-level JavaScript (Advanced > Document Processing > Document JavaScript (Acrobat 9), or Tools > JavaScript > Document JavaScript) outside of a funtion definition, or in the initial page's Page Open event.
As mentioned, you can also place it in the "Document WIll Print" event if you want it to update at the time of printing. In Acrobat 9 you'd select "Advanced > Document Processing > Set Document Actions" and in Acrobat 10 you'd select "Tools > JavaScript > Set Document Actions".
Actualy, looking around the web I found another Adobe forum where you answered another person's question about using a check box to populate a text field with the date, which is actually what I really need, as I want to be able to print the form with or without the date and time appearing. Here's the script you posted:
// Mouse up script for check box
{function () {
// Get a reference to the text field
var f = getField ("text");
// Set the value of the text field
if (event.target.value !== "off") {
f.value = util.printd("mm/dd/yyy", newDate ());
} else {
f.value = " ";
}
} ) ();
I copied and pasted the code straight into the mouse up event for the check box, and then changed the text box name to the actuall name of the date text field, and the error I get is "too much recursion".
That code does't look like it was correctly copied, or else I made a few mistakes. It should be:
// Mouse up script for check box
(function () {
// Get a reference to the text field
var f = getField("text");
// Set the value of the text field
if (event.target.value !== "Off") {
f.value = util.printd("mm/dd/yyy", newDate());
} else {
f.value = "";
}
})();
There would have to be a text field named "text" for this to work.
Hello: I'm new to Adobe Foms and I'm using Adobe Pro X.
I'd like to have the current date inserted when the form opens. I inserted the code below in the Document Javascript section of Adobe. When I open the form nothing happens. I'd appreciate any assistance you can give.
function Current_Date()
{getField(Prepared_Date).value=util.printd("mm/dd/yy",new date())
}
North America
Europe, Middle East and Africa
Asia Pacific