|
Hi Dave, I don't know if this is what is needed, because the time display is refreshed only when any other field value is entered or changed, but here is code that I used as the "Custom Validate Script" under the "Calculation" tab under Field Properties for the time field (which I made read-only).
// Display the current time. writeTime();
Here are the two functions to place as Document-Level _javascript_ functions.
function writeTime() {
// get a date object var today = new Date();
// ask the object for some information var hours = today.getHours(); var minutes = today.getMinutes(); var seconds = today.getSeconds();
// fixTime makes the minutes and seconds look right // it just sticks a zero in front of numbers less than 10 minutes = fixTime(minutes); seconds = fixTime(seconds);
// put together the time string and write it out event.value = hours + ":" + minutes + ":" + seconds; }
function fixTime(the_time) {
if (the_time <10) { the_time = "0" + the_time; } return the_time; }
Let me know if there are any problems with or questions about this technique.
P.S. To be honest (which I am sometimes), I adapted the above code from some I found on the Web: http://hotwired.lycos.com/webmonkey/98/29/index2a_page5.html?tw=programming.
-----Original Message-----
Hi list, I've looked and found several ways of doing this (allegedly) but no success yet. Can someone please provide a sure fire way of achieving the current time in a form field - displaying the same time as the pc clock, not the point when the document was opened (it could be open all day !!) Thanks, Dave |
Title: Time form field
- [PDF-Forms] Time form field Marston, David
- RE: [PDF-Forms] Time form field Lance A Williams
- Day, Tim G.
