These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Date/Time stamp on submit

Dripto
Registered: Jun 20 2007
Posts: 47

Hi,

I have a field in a form which needs to be populated with the current date and time automatically when a user clicks the submit button. What's the script for that?

Please let me know if you need additional information.

Thanks,
Dripto

My Product Information:
LiveCycle Designer, Windows
Script Kitty
Registered: Jul 9 2010
Posts: 19
I couldnt find a script for *exactly* what you want, but here is some information about using acrobat and javascript for timing (it has a nice little tutorial and a pdf with a clock on it):
http://www.acrobatusers.com/tutorials/working-date-and-time-acrobat-javascript-part-3-3

Here is how to make a "field" preform an action i.e. run the populate time script, you can also modify this function to make a field that preforms no action but will be populated with the time, first though you will need the quad location of where you want the information to be populated (http://www.acrobatusers.com/tutorials/2008/07/auto_redaction_with_javascript):
... the "strAction" is all of the javascript the want the script to preform in string.
function AddButton(nPageNum, x, y, width, height, strText, strCaption, strToolTip, strAction)
{
var aRect = this.getPageBox( { nPage: nPageNum} );
aRect[0] += x * inch;
aRect[1] -= y * inch;
aRect[2] = aRect[0] + width * inch;
aRect[3] = aRect[1] - height * inch;

var f = this.addField(strText,"button", nPageNum, aRect);
f.setAction("MouseUp",strAction);
f.userName = strToolTip;
f.delay = true;
f.borderStyle = border.s;
f.highlight = "push";
f.textSize = 0; // autosized
f.textColor = color.blue;
f.strokeColor = color.blue;
f.fillColor = color.white;
// you can specify a different font here, otherwise it uses a default one
//f.textFont = font.ZapfD;
f.buttonSetCaption(strCaption);
f.delay = false;
}

Here is the javascript api:
http://www.adobe.com/devnet/acrobat/pdfs/js_api_reference.pdf

Make friends with it.