Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

changeable Current Date field

Avatar

Level 3

I need the "Current Date" field enabled to be changed by the user. Any help will be appreciated.

I thought the "Calculated - User can Override" would work but no such luck! (I am using the Custom - Current Date field)

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The custom current date has the script in the layout:ready event. This fires everytime the user exits an object that has been changed.

So what is happening is that the user can access the date field and change the value, however when they exit the field, the layout:ready event fires and the user-entered data is overwritten by the current date.

You could move the script from the layout:ready event to the docReady event. This is a good event because it only fires once, when the form is opened/rendered.

You will probably need to wrap the script in an if statement, so that when the form is reopened, it does not overwrite the date. The following FormCalc should work:

// Current Date in short-style date format.

if (HasValue($) eq "false") then

     $.rawValue = num2date(date(), "DD.MM.YYYY")

endif

There is an example here: https://acrobat.com/#d=QR1y1RYatwSaQAWa4-jLlA

You can see events and how they fire here: http://assure.ly/gW3RNr

Hope that helps,

Niall

View solution in original post

3 Replies

Avatar

Level 3

Hi NorteIT,

I had the same problem and found this... http://forums.adobe.com/message/1346945#1346945

I normally do things in JavaScript, but this solution is in FormCalc.  What the heck, it works.

$.rawValue = Concat(Num2Date(Date(), "YYYY-MM-DD"))

The writer in the above thread said they did it under a Form:Ready event.  I did it in an Enter event.  Either way it works.

Hope that helps,

Peta

Avatar

Correct answer by
Level 10

Hi,

The custom current date has the script in the layout:ready event. This fires everytime the user exits an object that has been changed.

So what is happening is that the user can access the date field and change the value, however when they exit the field, the layout:ready event fires and the user-entered data is overwritten by the current date.

You could move the script from the layout:ready event to the docReady event. This is a good event because it only fires once, when the form is opened/rendered.

You will probably need to wrap the script in an if statement, so that when the form is reopened, it does not overwrite the date. The following FormCalc should work:

// Current Date in short-style date format.

if (HasValue($) eq "false") then

     $.rawValue = num2date(date(), "DD.MM.YYYY")

endif

There is an example here: https://acrobat.com/#d=QR1y1RYatwSaQAWa4-jLlA

You can see events and how they fire here: http://assure.ly/gW3RNr

Hope that helps,

Niall