×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Auto-Updatable Date Field

Auto-Updatable Date Field

Auto-Updatable Date Field

(OP)
On an Acrobat form, I have a date field that I would like to have show the current date before the user begins filling the form. Maybe it can simply look to see if they've entered their name and that would be enough to make in lock into whatever the current date is.

For testing purposes I have it set to use the time rather than the date and date field is called "Today" while the name field is "01":

CODE

var f = this.getField("Today");
if this.getField("01"){
f.value = util.printd("HH:MM:ss", new Date());
}

RE: Auto-Updatable Date Field

(OP)
I have modified the conditional a bit and have eliminated the errors but it's still not working properly.  Even without any conditional at all, the field does not get updated. It changes only when I modify and re-save the JavaScript but not when I close and re-open the form. Any ideas and to make it more dynamic? This is what I have so far:

CODE

var f1 = this.getField("01");
var f2 = this.getField("Today");

if (f1.value == "") {
f2.value = util.printd("HH:MM:ss", new Date());
} else {
f2.value = "";
}

RE: Auto-Updatable Date Field

(OP)
Okay, I found the problem and that was tha the script needed to be in the Full Name field rather tha being in the Today field and I removed the else from the conditional. Now it works as it should:

CODE

var f1 = this.getField("01");
var f2 = this.getField("Today");

if (f1.value == "") {
f2.value = util.printd("HH:MM:ss", new Date());
}

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close