Skip to main content
June 28, 2019
質問

Missing ; error message

  • June 28, 2019
  • 返信数 1.
  • 517 ビュー

I am trying to make a PDF for school fees automatically calculate when the user enters the number of children in each department (P, H or N). I thought I had the code figured out, but I am getting an error message stating "missing ; before statement 3: at line 4" and it highlights the line I made red. I tried adding a ; at the beginning of that statement, but the error message did not change. Any help would be greatly appreciated.

var c2 = 1950; var c3 = 2150; var c4 = 2350; var c5 = 2550;

var children = this.getField("P").value + this.getField("H").value + this.getField("N").value;

var full = this.getField("P Calc").value + this.getField("H Calc").value + this.getField("N Calc").value);

if (children > 4) {

event.value = Math.min(full,c5);

} else if (children > 3) {

event.value = Math.min(full,c4);

} else if (children > 2) {

event.value = Math.min(full,c3);

} else if (children > 1) {

event.value = Math.min(full,c2);

} else {

full;

}

このトピックへの返信は締め切られました。

返信数 1

Bernd Alheit
Community Expert
Community Expert
June 29, 2019

Before the red line remove ) before ;

June 29, 2019

Thanks, Bernd. I was totally focused on the semicolons due to the text of the error message.

Any idea why it would work up to the last else statement, then always give the full amount instead of c2?

Bernd Alheit
Community Expert
Community Expert
June 29, 2019

You must use event.value = full;