Skip to main content
Jun 28, 2019 8:56 PM UTC
Question

Missing ; error message

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;

}

This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

Bernd Alheit
Community Expert
Community Expert
Jun 29, 2019 9:21 AM UTC

Before the red line remove ) before ;

Translate
Jun 29, 2019 2:19 PM UTC

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?

Translate
Bernd Alheit
Community Expert
Community Expert
Jun 29, 2019 2:43 PM UTC

You must use event.value = full;

Translate