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

How can i set the reset button to have the current date/time run the calculation script again?

lamnator
Registered: Feb 4 2011
Posts: 1

Here is my problem.
 
I had to design a pdf form to be filled out on a ipad. The problem with ipads are that they do not close pdfs or does the allow reset button to natually change the current date/time with a current runtime property like it does in acrobat.
 
When i load the pdf for the first time in the app using the runtime property, nothing displays until i hit the reset but it won't keep updating the current time.
 
My Runtime Property:
form1.#subform[0].DateTimeField1::ready:layout - (FormCalc, client)
$.rawValue = Concat(Num2Date(Date(), "EEEE, MMMM DD, YYYY"), " ", Num2Time(Time(), "HH:MM:SS"))
 
What can i do differently to get this to work?
 

My Product Information:
LiveCycle Designer, Mobile
DaveyB
Registered: Dec 10 2010
Posts: 70
Firstly, put the runtime property in the initialize event. This will give the field a starting value once the form is opened. This is from one of my forms (for a date only field):

$.rawValue = num2date(date(), "EEE, MMM D, YYYY")

This works for me! Now, in the script for your reset button, here is the script I use to update the time field (I have the date and time separated into two distinct fields):

xfa.host.resetData("xfa.form.form1.CallData")
dtTimeRecd.rawValue = Num2Time(Time(), "HH:MM")

This serves to clear all entries from the CallData form, then populate the dtTimeRecd field (in that same form) with the current time.

I went a few steps further with this, and used the exit event for the first field on the form to update the time field also, so as soon as the user starts entering data, the time is updated - I leave the date field alone since that records the 'shift start' date for me.

Hope that helps!

DaveyB

LiveCycle Designer 8.0
"Genius is one percent inspiration, ninety-nine percent perspiration." ~~ Thomas Edison
"If at first you don't succeed, get a bigger hammer." ~~ Alan Lewis
"If the conventional doesn't work, try the unconventional" ~~ DaveyB