Our form has some column headers that need to change each year, the headings are current year (2010) + previous 3 years. Am trying to programatically add the titles to eliminate modifying the form just to change the year, but not finding how to accomplish, and was checking out some date samples found, but no success yet. My question is 2 part - how/where do I put code, I don't need the user to enter anything, just want a column header. This example below is where I copied the idea from a sample and tried to adjust, it's on the calculate event of a date/time field, and I get an error message that says 'the display pattern "date-{MM/DD]" is incompatible with the object's data format. Define a compatible Display pattern. This display pattern error is the 2nd part of the question. How do I display only the 4 digit year?
year1.rawValue
= num2date(date(), "YYYY")
How do I accomplish this - am newbie on this! Thank you very much!
Solved! Go to Solution.
Views
Replies
Total Likes
I'd be happy to take a look at the form. stwalker.adobe@gmail.com
Steve
Views
Replies
Total Likes
1) I typically use a hidden field to capture the current date on the layout:ready event.
2) If year1 is a date object your script is valid but you are probably missing the display pattern date{YYYY} on year1.
If year1 is a text field you could could capture current year in a hidden field as
// form1.page1.currentYear::ready:layout - (FormCalc, client)
$.rawValue = Num2Date(Date(), "YYYY")
where currentYear has the display pattern date{YYYY} and add
this.rawValue = form1.page1.currentYear.rawValue;
to the calculate event of year1.
Steve
Thank you, my field is a date field, though it's giving me the error I mentioned when I use that format. I am totally new at this in LiveCycle so I'm not sure I'm putting the code in the right place, and not sure how to remove the error, maybe if I use your idea to bounce a text box off the date field and format the text box - it's all over my head at the moment, so I appreciate the help, thank you.
Views
Replies
Total Likes
I'd be happy to take a look at the form. stwalker.adobe@gmail.com
Steve
Views
Replies
Total Likes
Thank you for your help, to share your solution, I had my script in the wrong place, it should have been in FormCalc calculate event, and I was not using case sensitive field or function names, and did not have my display pattern right, it should have been date{YYYY}
Corrected:
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies