You are on page 1of 3

Bomeist

Time and Date when saving a fillable form


Jul 22, 2013 12:29 PM Categories: Windows Tags: #java #time #date #acrobat_forms #javeascript #saved_form I have created an order form for my company and I am having problems with creating a java script that will put the Date and Time at the top of the form only when it is saved. How would I go about this I have tried a few different scripts with no avail. var ft = this.getField("Time_Saved"); ft.value = util.printd("HH MM ss", new Time()); var oNow = new Date(); var sSubDate = util.printd("mmm dd, yyyy", oNow ); this.getField("Invoice_Date").value = sSubDate; // var f = this.getField("DatePrinted"); // field object // f.display = display.noView; // only print the field // f.value = "Printed on: " + util.printd("mmm dd, yyyy", new Date()); // // set the value of the field // get the current date/time object var oNow = new Date(); // create date time sring for sumbission var sSubDate = util.printd("dd/mmm/yyyy h:mm tt", oNow); // fillin field for date and time of sumission this.getField("SubmitDate").value = sSubDate; If someone is able to help me though this that would be great more or less what am i doing wrong?

376 Views 5 Replies Latest reply: Gilad D (try67), Jul 22, 2013 3:37 PM

Replies

1. Gilad D (try67),
Jul 22, 2013 12:41 PM in reply to Bomeist Report

Where are you placing this code?

| Mark as:

2. Bomeist,
Jul 22, 2013 2:47 PM in reply to Gilad D (try67) Report

Documnet Actions > Doucument Will Save

| Mark as:

3. Gilad D (try67),
Jul 22, 2013 2:53 PM in reply to Bomeist Report

OK. First off, there's no "Time" object in JS. Use only Date. So this: ft.value = util.printd("HH MM ss", new Time()); Should be: ft.value = util.printd("HH MM ss", new Date()); After you've done that, if it's still not working, describe what exacly happens, including any messages you see in the JS console.

| Mark as:

4. Bomeist,
Jul 22, 2013 3:32 PM in reply to Gilad D (try67) Report

THANK YOU SO MUCH I HAVE BEEN WORKING ON THIS FOR ABOUT A WEEK!!! UR AWSOME!!!

| Mark as:

5. Gilad D (try67),
Jul 22, 2013 3:37 PM in reply to Bomeist Report

A week? You should really try to learn a bit more core JavaScript if you plan to create more such scripts... Also, make sure you tick on the option in Acrobat to show the console on errors and warnings. You should see there something like this (when running the old code): ReferenceError: Time is not defined This immediately lets you know that something with that line is not correct...

| Mark as:

Adobe Community powered by Jive SBS 4.5.6.3 forum software

Jive Software

You might also like