I have two date fields "Start_Date" and "End_Date". User selects the start date. Then the form takes that date and adds 365 days. puts the result in the "End_Date" field. I have attempted a couple of scripts and none have worked. So I attempted to first just get the selected date in the "Start_Date" field to show in the "End_Date" field. When I select a date like, "May 28,2008" the output reads "Object44194500". Using the following script in the "Start_date" field
2. Using FormCalc - there are buikt in functions that allow you to do Date arithmetic. There is a function that will give you the number of days that have transpired from a set date in time. Once you have that you can add your 365 days to it then call the reverse function to turn it back into a proper date.
In either case it will get more complicated because you will have to deal with leap years to ensure that you get the right answer.
For setting one date to the other you will need to add a .rawValue on the end of the this statement. The way you have it coded now you are passing a complete object (by using "this" you are saying that you want the current object). The complete object can not be equated to the rawValue of the End_Date.
I've received your sample, thanks Paul! Can i check with you, can we have a script on the Calculate event at the end date so that it computes the end date automatically with Start Date + 365? Can you help me on this too?