Expand my Community achievements bar.

SOLVED

How to make a calculated date unchangeable after save/ submit

Avatar

Level 1

HI all,

I have created a form that logs service calls. After filling out the reporting person's name, a current date and time is generated. The problem is that the next time I open this file, the date defaults to the current one. I would like to know how to commit the date when the form is saved, so it does not auto update next time I open the form. Any help is greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Locking only stops the user from changing the field ....programs can still touch them. Yes you can send me the form .....include a description of the issue as the forum and the email are not tied together and I get easily confused as to which one goes with what. You can send it to LiveCycle8@gmail.com

Paul

View solution in original post

11 Replies

Avatar

Former Community Member

You could wrap your calculation in a test to see if there is not a value in the field. If there is then do not do the calculation. Something like this:

if (this.rawValue == null){

     put date calculation here

}

Avatar

Level 1

Here is my Formcalc

script on the calculate event. It works perfectly, however, when re opening the document , the date is changed to the current date and time. I would like for it to remain unchanged. How do I go about converting the script below to Javascript so I can use the suggestion you gave above?  Tahnsk for your help.

if

(Row1.Cell8 <> null )

 

then

Concat(Num2Date(Date(), "MMMM DD, YYYY"), " ", Num2Time(Time(), "HH:MM"))

else

null

endif

Avatar

Former Community Member

There is nothing wrong with that script except that you are saying if the form is NOT equal to null (meaning it is populated) then set the date...I think you want to test if it IS equal to null (==) then that means it is empty and you want to set the date. Also ....did you chose the calculate event for a specific reason?

paul

Avatar

Level 1

The date field is populated when Cell8, which contains name is populated. I wanted it to be empty until a name is filled in. That is why I have it as null. I am trying to figure out how to convert the code you gave me above to formcalc so I can add it to my own, or how to change my  formalc sript to Javascript so I can have both on the calculate event of the date/time field. Thanks for you help.

Avatar

Former Community Member

My code in FormCalc woudl be:

if ($.rawValue == null) then

     put date calculation here

endif

Paul

Avatar

Level 1

Actually I would like the date to be input, only if the name has been entered in cell8, if the name has not been enterd I would like for

it to remain blank. my formcalc takes care of this, but where I have a problem is tahat on reopening the doc, I would like for this date not to be changed to the current one. I have experimented with a lock script for all fields that is run on presave, and though it locks the other fields it does not lock the date field, and it keeps getting updated every time the form is reopened. My other option is to have the date manually entered, but this leaves room for manipulation. Is there a way I could lock the value in the date field? any help is appreciated.

Avatar

Former Community Member

So we can check to see if there is anything in the field and set the date but how will we know if this is the 1st time opening or the next time. We could set a flag (a hidden field) that we can check instead of the field. We coudl set the flag on the exit of the field so if the flag is set then we know that the field has been set. So we woudl test to see if the flag was set (tells us if this is the 1st time opening), if yes and there is data in th efield then do not set the time.

Make sense?

Paul

Avatar

Level 1

Yes, this makes a lot of sense, The problem is how do I go about setting it, and on what event should it be set. I originally thought of locking all date fields with a value on save, but it doesnt seem to work on reopening the form eventhough the locking takes place. I guess on re-opening the doc it runs the calculate again even though the fields are locked. Can I pm you the form so you can see how I have it as I cannot upload it here? Since I guess Im new that option is not available.

Avatar

Correct answer by
Former Community Member

Locking only stops the user from changing the field ....programs can still touch them. Yes you can send me the form .....include a description of the issue as the forum and the email are not tied together and I get easily confused as to which one goes with what. You can send it to LiveCycle8@gmail.com

Paul

Avatar

Level 1

HI Paul,

Tahnks for your help so far. I have attached the form. I want to be able to

have the date field hold the original value entered, and not to change

everytime the form is opened. Here is the issue as I outlined in the Forum:

How to make a calculated date unchangeable after save/

submit<http://forums.adobe.com/message/2680289#2680289>

HI all,

I have created a form that logs service calls. After filling out the

reporting person's name, a current date and time is generated. The problem

is that the next time I open this file, the date defaults to the current

one. I would like to know how to commit the date when the form is saved, so

it does not auto update next time I open the form. Any help is greatly

appreciated.

Avatar

Level 1

Just sent the form. Thank you sooo much for your help so far.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----