Show subforms based on current date when form opened

stephenf8734174

23-03-2016

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.

Accepted Solutions (0)

Answers (4)

Answers (4)

stephenf8734174

29-03-2016

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.

_Bruce_Robertson

MVP

29-03-2016

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

stephenf8734174

28-03-2016

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.

_Bruce_Robertson

MVP

24-03-2016

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