Print Page | Close Window

Unique ID

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
URL: http://forums.planetpdf.com/forum_posts.asp?TID=156
Printed Date: 19 Aug 2019 at 2:31am
Software Version: Web Wiz Forums 11.10 - http://www.webwizforums.com


Topic: Unique ID
Posted By: jhinckley
Subject: Unique ID
Date Posted: 29 Dec 2011 at 9:24pm
I came across the code shown at the bottom of the post, and it does pretty much what I want but not completely. It enters a unique id number in the correct field upon opening the form which is what I thought I wanted at first. Now I think it would be better if after the user completes the form and presses the submit button, that that action first generates the number, enters it into the field and then sends the form to the specified e-mail address.
 
Is this possible?
 
var f = this.getField("NCR#");
var g = f.value;
if (g == 0)
{
var dt;
Today = new Date();
dt = Today.getTime();
this.getField("NCR#").value = dt;
}



Replies:
Posted By: gkaiseril
Date Posted: 29 Dec 2011 at 9:37pm
Yes, but you will have to write a custom JavaScript for the submit button action.


Posted By: try67
Date Posted: 30 Dec 2011 at 12:13pm
Not necessarily. You can add the code, as it is, to a Execute JavaScript action, and then add a separate Submit Form action after that, which doesn't involve any JavaScript code.

-------------
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com


Posted By: gkaiseril
Date Posted: 30 Dec 2011 at 8:57pm
If you want to make sure the id is added before the submit action, I would write the entire process as one action since the actions run asynchronously, that is the first action does not need to complete before the following actions are run.


Posted By: jhinckley
Date Posted: 14 Jan 2012 at 12:24am

I've thought about this some more and decided to run it in the Actions tab in the field. I've selected Mouse Exit as the trigger. Is that a good approach?

My new issue is that the number is 13 digits. Much too long. I'd like it to be six digits. Any help in modifying the original code to accomplish this would be much appreciated.


Posted By: mmazal
Date Posted: 23 Feb 2012 at 1:40pm
old post so probably done already but...
 
var dt;
Today = new Date();
dt = util.printd("ddmmyy", Today);
//or change the "ddmmyy" to some other format



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 - http://www.webwizforums.com
Copyright ©2001-2017 Web Wiz Ltd. - https://www.webwiz.net