Ok ok. Hope someone can help me out here!
I tried this in Acrobat Pro first, but I dont know Javascript and so couldn't modify the "Call Date" script to get the Time instead.
Fortunately, I also have Livecycle and everything looked so simple BUT it's not working.
Let me explain what I'm trying to do. My boss asked me to develop a log entry form in where after the user types in an entry and leaves the field then the time of the entry is automatically logged. This field should be unalterable.
I set up a Text Field (to act as the log entry form field). I then set up a Date/Time field. I went to Binding and changed it to Time. I changed the Value to Read Only, and then the Pattern to h:MM A.
Set up the action- when user exits the text field, the Date/Time field value is inserted automatically.
This works beautifully EXCEPT I only get the DATE! I've tried Protected, Read Only (calculated) etc. This requires a script to be called.... the very thing I hoped to avoid since I can't code. RunTime worked somewhat-- but in the PDF itself, when the user exits the text field, the date AND time shows up, but if that field is clicked, the time is updated. I don't want it updated. My boss wants to see the time that the log entry was completed so it can't be changed by the user or updated.
I hope I'm clear as to what I need. Anybody can help? Hope so!
Thanks--
-carrie
Solved! Go to Solution.
Views
Replies
Total Likes
if ($.rawValue <> null)then
Log1.rawValue
= Num2Time(Time(), "HH:MM:SS")
$.access
= "readOnly"
endif
Views
Replies
Total Likes
Test if the field is null before assigning the current date.
// form1.page1.currentDate::ready:layout - (FormCalc, client)
if (this.isNull) then
$.rawValue = Concat(Num2Date(Date(), "MM/DD/YYYY"))
endif
Deborah
Views
Replies
Total Likes
Here is an example .....you will need to write code on the exit event of the TextField that you want to lock. The corresponding Log Time field wil get set only if you enter a value.
Hope that helps
Paul
Views
Replies
Total Likes
Paul, your file has exactly what I want!
But I'd sure love to know how to do that. I'll need to add more of those fields etc so knowing the underpinnings is a necessity.
I was right- the action I wanted was based on 'Calculated-Read Only' in the value setting. However, how to add the script?
Views
Replies
Total Likes
Deborah,
Being the newbie that I am, I can't make sense of your answer. I assume you mean to use FormCalc to create the script that the 'Calculated-Read Only' value setting will refer to?
Views
Replies
Total Likes
Are you creating your form in Acrobat or LiveCycle Designer. A little hare to tell with all of your posts.
For Acrobat forms:
You can get a lot of different information from the date object by changing the format string for the 'util.printd' method. See the reference George Johnson links to for the format string values that can change the displayed value.
// get new Date object
var d = new Date();
// format to h:MM tt
var sDate = util.printd("h:MM tt", d);
// insert date into form field
this.getField("todaysDate").value = sDate;
h - hours without leading zero
MM - minutes with leading zero if necessary
tt - am or pm designator
For LiveCycle Designer you can select the 'Custom' form tab and then the 'Current Date' field. Now change the script to:
$.rawValue
= num2Time(time(), TimeFmt(1))
More information about the time format is the 'Scripting Reference' under LiveCycle Designer's 'Help' menu option.
For the field object, you can set the "Value" "Type:" option to "Calculated - Read Only". But if you use the predefined 'Current Date' field, this is already done for you.
Views
Replies
Total Likes
if ($.rawValue <> null)then
Log1.rawValue
= Num2Time(Time(), "HH:MM:SS")
$.access
= "readOnly"
endif
Views
Replies
Total Likes
Strange, the text you mentioned is not showing up in red. I checked in another broswer and it's not showing up either. What was the name of your object?
Views
Replies
Total Likes
It looks like the colour is not coming through ....
The object is called Log1 and is at the beginning of the 2nd line.
Paul
Got it working!!
Thank you so much, Paul.
Also thanks to those of you who took the time to reply. Really appreciate it.
Views
Replies
Total Likes
Views
Likes
Replies