Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

My interactive form is a hot mess (multiple problems with javascript and formcalc)

Avatar

Level 1

I have been working on a dynamic expense report form for our company but have run into a number of problems. I would appreciate help with any of these!

Problem 1:

Last subform: Table 4 (Miscellaneous Expenses) - This subform does not force down the footer section (signature, comments) like the other subforms do. The table is located in a positioned subform inside a flowed subform. The other 3 tables have no problem pushing the data down.

Problem2:

The minus button on the tables (to subtract a row) USED to work but now do not.The minus button on EVERY table is broken.

Problem 3:

The add row button still works fine on most of the tables (with exception of the last table, MISC Expenses). If I add a few lines to the last subform it seems the buttons stops working altogether past row 3. you have to add 2 rows to the final table (Misc Expenses) to see what I mean. It seems to me that this problem is probably related to Problem 1 somehow.

Problem 4:

Can't get GRAND TOTAL working no matter what I try.

I uploaded my work in progress here: www.essential-equipment.com/pdf/ExpenseReport.pdf

If anyone is able to help me I would greatly appreciate it.  Also, would it be hard to make this form able to carry over to a new page?

Thanks in advance to anyone that helps

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi.

Problem 1:

The sourrounding subform "Table4Subform" is not set to fit the hight automatically.

Problem 2.

The remove script is way to complex, use this script instead:

if (this.parent.parent.instanceManager.count > 1) {

          this.parent.parent.instanceManager.removeInstance(this.parent.parent.index);

}

Problem 3:

Remove the Grouping "Body", then the subform flow crrectly to the next page.

Problem 4:

The reference to the total fields are not correct, that's why the grand total script fails.

Change it into:

Sum(Table1Subform.Table1.FooterRow.Total1, Table23Subform.Table2.FooterRow.Total2, Table23Subform.Table3.FooterRow.Total3, Table4.FooterRow.Total4)

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi.

Problem 1:

The sourrounding subform "Table4Subform" is not set to fit the hight automatically.

Problem 2.

The remove script is way to complex, use this script instead:

if (this.parent.parent.instanceManager.count > 1) {

          this.parent.parent.instanceManager.removeInstance(this.parent.parent.index);

}

Problem 3:

Remove the Grouping "Body", then the subform flow crrectly to the next page.

Problem 4:

The reference to the total fields are not correct, that's why the grand total script fails.

Change it into:

Sum(Table1Subform.Table1.FooterRow.Total1, Table23Subform.Table2.FooterRow.Total2, Table23Subform.Table3.FooterRow.Total3, Table4.FooterRow.Total4)