Currently I have a Date/Time Field that has a FormCalc script under the calculate section, that is "Concat(Num2Date(Date(), "MM/DD/YYYY"))", which works great at pulling the current date into my form. My problem is that my users need to be able to type in or select a different date from the calendar, which they currently can do, but the selected/typed date will not stay in the field because it's overwritten by the current day. Anyone have suggestions? Thanks.
Views
Replies
Total Likes
Hi,
Copy the script out of the calculate event and place it in the docReady event. This event only fires once, when the form is opened and rendered. Then in the Object > Value palette make sure that the type is set to "Optional".
You will want to wrap the date line of script in an if statement to check that there isn't a date already in the field, otherwise the date the user entered will be automatically overwritten when the form is reopened.
There is an example here: https://acrobat.com/#d=QR1y1RYatwSaQAWa4-jLlA.
Hope that helps,
Niall
Thanks for the quick response. Your suggestion did help but it'd broke another Date/Time field I have that calculates the day of the week based off the current date. The second field has another FormCalc script under the calcuate sections, which is shown below, I've tried moving it to different sections as you recommended with the other script but it's not working as expected. Any more suggestions? Thanks.
if
(HasValue(workdate)) then
Num2Date( (Date2Num(workdate.formattedValue
, "MM/DD/YYYY") +0 ), "EEEE")
else
null
endif
Views
Replies
Total Likes
Nevermind, I believe I found the issue myself. Needed to validate the format of both scripts to the same style.
Thanks again for you help!
Views
Replies
Total Likes