Expand my Community achievements bar.

Show subforms based on current date when form opened

Avatar

Level 3

Hi, I want a form to display 3 subforms (1 month per subform) based on the current date when the form is opened. The 3 pages would be the current month when opened plus the next two months. The subforms will contain a calendar of the current month plus a couple of other fields. Each subform will be 1 page. Is this possible? Thanks for any help.

4 Replies

Avatar

Level 10

Hi,

If the subform is repeating with an initial count of 3 then you could use the subforms index property to add that number of months.  So something like this in the initialise event;

var today = new Date();

var currentMonth = new Date(today.setMonth(today.getMonth() + Subform1.index));

this.rawValue = util.printd("yyyy-mm-dd", currentMonth);

This assume the subform is called Subform1.

Here's a sample, https://sites.google.com/site/livecycledesignercookbooks/home/stephenf87341748.pdf?attredirects=0&d=...

Bruce

Avatar

Level 3

Hi Bruce,

Thanks for your response. The subform is not repeating - it will be a positioned different subform on each page containing a month calendar per page. When the document is opened, depending on the current date, the current month plus the next two (e.g. March, April, May) become visible and these three pages will then be printed. Is this possible?

Thanks for your help.

Avatar

Level 10

Hi,

I guess I'm not sure what is on the three pages, are you meaning a grid like this;

blank-March-2016-calendar.jpg

I did a similar thing a while back, not a month per page but a month per row.  Adobe LiveCycle Designer Cookbooks by BR001: Season Planner (or Year Planner) PDF Template, but some of the calculations would be similar.

Is this the sort of thing you are after?

Bruce

Avatar

Level 3

Hi Bruce - that PDF is brilliant, but I'm after something hopefully simpler. The form will have 24 hidden subforms (1 for each month for the next two years. These subforms will each be one page and be static - the form will be printed out for use by clients). I would like to include a 'current date' field that is invisible, and when the form is opened, the date makes the current month, plus the 2 following months visible and then the form will be printed. Is this possible? Sorry if I'm haven't made sense so far. Thanks for your help.