We have a text field on all of our forms which we prefill with the following javascript in order to capture/record the date and time in which the submit button was pressed. This is working great except in the case of our Korean end users. We are getting strange characters in the data which is causing problems with subsequent code working on the exported form data which is expecting a valid date.
forms are created in teleforms. exported to pdf. scripted in adobe 5.0. posted on the web and filled out via the web by our end users with adobe reader version 5.0 and above.
script to prefill is:
var d = new Date();
this.getField("b12c96nfgroupstudyid").value =
util.printd("dd-mmm-yyyy",d).toUpperCase() + util.printd(" HH:MM:ss",d);
I am not sure where printd retreives the date from. Is it the workstation or our server. Is there a way to force the date to be from our server versus the client workstation? Would this be the answer to this issue?
The date and time come from the variable "d" which is the date time object from the end user's system.
// get the user's system date time object into variable "d"
var d = new Date();
// fill field with the variable "d" to the formatted date string example "31-Jan-2007"
// and then add the time from variable "d" to the formatted time string example "13:30:15"
this.getField("b12c96nfgroupstudyid").value =
util.printd("dd-mmm-yyyy",d).toUpperCase() + util.printd(" HH:MM:ss",d);
The last line could be rewritten as:
// format the user's date time object like "31-JAN-2007 13:45:55"
this.getField("b12c96nfgroupstudyid").value =
util.printd("dd-mmm-yyyy HH:MM:ss",d).toUpperCase();
So one has one format string and one variable.
Or as just one line of code:
// format the user's date time object like "31-JAN-2007 13:45:55"
this.getField("b12c96nfgroupstudyid").value =
util.printd("dd-mmm-yyyy HH:MM:ss", new Date()).toUpperCase();
George Kaiser