I have a basic form that requires 2 dates to be entered - a from date and an end date. However, the end date is always 10 days after the from date. Therefore, the user really need only enter the from date and then the form itself should calculate and display the end date as from date plus 10. How does one go about doing this? I am new to these forms but did evidently setup a 'calculate' script on the end date field (language='formcalc', run at='client', script='FromDate+10'). However, what I get in the end date field is a number (ie: 10 when FromDate is blank).
Another problem I am having is that calculated fields on the form do not seem to calculate when the form is opened in Reader (Adobe Reader 9). Actually, sometimes when previewing the form in Acrobat the fields don't calculate either. Is it not possible to have fields calculated for those using the form in Reader?
Any advice is greatly appreciated. Thank you.
Solved! Go to Solution.
Views
Replies
Total Likes
Ok,
the problem it the picture clause.
My one was "DD.MM.YYYY" but you use "YYYY/MM/DD".
Change the script into:
if (FromDate ne null) then
$ = Num2Date(Date2Num(FromDate.formattedValue, "YYYY/MM/DD") + 10, "YYYY/MM/DD")
endif
Views
Replies
Total Likes
This script in the layoutReady:event of the field "EndDate" should to the trick
$ = Num2Date(FromDate.formattedValue + 10, "DD.MM.YYYY")
Views
Replies
Total Likes
This is great, I am now getting something showing in the field. However, not the value I was expecting. In particular, when you open the form (before you put any value into the 'from date') the 'end date' shows as 10.01.1900. So, it is a date which is good. Then when I enter a date into the 'from date' field (say Dec 21, 2010), the 'end date' does not change. It just remains as 10.01.1900.
Views
Replies
Total Likes
Hm ok,
try this script.
I tested it and it works as exspected
$ = Num2Date(Date2Num(FromDate.formattedValue, "DD.MM.YYYY") + 10, "DD.MM.YYYY")
Views
Replies
Total Likes
I get the same result with this one - just shows as 10.01.1900
Views
Replies
Total Likes
Here's a working sample
Views
Replies
Total Likes
This sample does work for me (if i enter the first date, then the second date is calculated and displayed) if I open it in Acrobat. However, if I use Reader it does not work (doesn't calc/show the end date).
I have put the 'script' code from the sample into my form (complete with the if statement). If I open the form with Acrobat it does show the end date, however, it is still '10.01.1900'. There must be something going on with my form that is stopping it from correctly calculating. Also, the other issue i'm having is that calculated fields won't show anything if the form is opened with Reader.
Views
Replies
Total Likes
Can you upload the form?
Views
Replies
Total Likes
I'm sure I can - will just have to figure out how/where to do that. I assume there is an area on the adobe forum site for this?
Views
Replies
Total Likes
Use Acrobat.com or another file hoster service and add post the link.
Views
Replies
Total Likes
Here is the link...
Views
Replies
Total Likes
Ok,
the problem it the picture clause.
My one was "DD.MM.YYYY" but you use "YYYY/MM/DD".
Change the script into:
if (FromDate ne null) then
$ = Num2Date(Date2Num(FromDate.formattedValue, "YYYY/MM/DD") + 10, "YYYY/MM/DD")
endif
Views
Replies
Total Likes
Great, I have made the adjustments as you suggest and the end date field does now calc and display the expected date, However, the calc field still does not work when the form is opened in Adobe Reader (it only works if opened in Acrobat). Do you know why this is the case? I have changed and reuploaded the file which is at...
Views
Replies
Total Likes
I just found the answer to why the form did not calc/display fields in Adobe Reader. You have to ensure that javascript is enabled within your Adobe Reader application (under preferences). Pretty obvious thing. Guess I wasn't smart enought to find it earlier. Thanks.
Views
Replies
Total Likes
Views
Likes
Replies